Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
glue to make blessed (low-level API) work in browserify with term.js
var blessed = require("blessed");
window.onload = function () {
var term = new Terminal({
cols: 80,
rows: 24,
useStyle: true,
screenKeys: true
term.write('\x1b[31mWelcome to term.js!\x1b[m\r\n');
// glue to make blessed work in browserify
term.columns = term.cols;
term.isTTY = true;
require('readline').emitKeypressEvents = function () { }; // Can I side-affect a module this way? Apparently.
process.listeners = function fakelisteners() { return []; };
var program = blessed.program({input: term, output: term, tput: false});
program.move(1, 1);'black');
program.write('Hello world', 'blue fg');
program.setx((program.cols / 2 | 0) - 4);
program.write('Hi again!');'!black');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.