JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 216
  • Score
    100M100P100Q77664F
  • License KINDLY

Listen for the terminal resize event in a friendly way.

Package Exports

  • cli-resize

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-resize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cli-resize Support this project

Listen for the terminal resize event in a friendly way.

Installation

$ npm i cli-resize

Example

// Dependencies
var CliResize = require("cli-resize");

// Listen for resize
var inst = new CliResize(function (err, size) {
    console.log(size);
});
console.log("Resize the terminal.");

// Deattach the listener
setTimeout(function() {
    inst.off();
    console.log("Deattached the listener.");
}, 3000);

// A hack to keep the process opened for 10sec
setTimeout(function() {
    console.log("Test ended.");
}, 10000);

Documentation

CliResize(callback)

Creates a new instance of CliResize

Params

  • Function callback: The callback function which is called when the terminal is resized.

Return

  • Object The CliResize instance.

size()

Gets the terminal size.

Return

  • Object An object containing the width and height values.

off()

Deattaches the callback from the functions list.

Return

  • Object The CliResize instance.

How to contribute

Have an idea? Found a bug? See how to contribute.

Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

License

KINDLY © Ionică Bizău