JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 178
  • Score
    100M100P100Q76313F
  • License MIT

Listen for the 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

Listen for the resize event in a friendly way.

Installation

Run the following commands to download and install the application:

$ npm install 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

  1. File an issue in the repository, using the bug tracker, describing the contribution you'd like to make. This will help us to get you started on the right foot.
  2. Fork the project in your account and create a new branch: your-great-feature.
  3. Commit your changes in that branch.
  4. Open a pull request, and reference the initial issue in the pull request message.

License

See the LICENSE file.