JSPM

  • Created
  • Published
  • Downloads 1066582
  • Score
    100M100P100Q181548F

A curses-like library for node.js.

Package Exports

  • blessed
  • blessed/lib/program

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 (blessed) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

blessed

A curses-like library for node.js.

As of right now, it does not read all terminfo. It was designed for one terminal's terminfo: xterm.

I want this library to eventually become a high-level library for terminal widgets.

Example Usage

var Program = require('blessed').Program
  , program = new Program;

program.on('key', function(ch, key) {
  if (key.ctrl && key.name === 'c') {
    console.log('This would have been SIGINT!');
  }
});

program.setMouse({ normalMouse: true });

program.mouse('mouse', function(data) {
  console.log('Mouse event received:');
  console.log(data.button, data.x, data.y);
});

program.alternateBuffer();

program.clear();

program.bg('white');
program.fg('blue');
program.write('Hello world');
program.fg('!blue');
program.setx(1);
program.down(5);
program.write('Hi again!');
program.bg('!white');
program.feed();

program.getCursor(function(data) {
  console.log('Cursor is at: %s, %s.', data.x, data.y);

  program.charset('SCLD');
  program.write('abcdefghijklmnopqrstuvwxyz0123456789');
  program.charset('US');
  program.setx(0);

  setTimeout(function() {
    program.eraseInLine('right');
    setTimeout(function() {
      program.clear();
      program.normalBuffer();
      program.setMouse({ normalMouse: false });
    }, 2000);
  }, 2000);
});

License

Copyright (c) 2013, Christopher Jeffrey. (MIT License)

See LICENSE for more info.