more refactoring of lib/blessed.
This commit is contained in:
parent
8d11075b89
commit
583fa4f6f7
|
@ -1,48 +1,29 @@
|
||||||
/**
|
/**
|
||||||
* Blessed
|
* blessed - a high-level terminal interface library for node.js
|
||||||
* A curses-like library for node.js.
|
|
||||||
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
* Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
|
||||||
* https://github.com/chjj/blessed
|
* https://github.com/chjj/blessed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* Modules
|
|
||||||
*/
|
|
||||||
|
|
||||||
var program = require('./program')
|
|
||||||
, tput = require('./tput')
|
|
||||||
, widget = require('./widget')
|
|
||||||
, colors = require('./colors')
|
|
||||||
, unicode = require('./unicode');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blessed
|
* Blessed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function blessed() {
|
function blessed() {
|
||||||
return program.apply(null, arguments);
|
return blessed.program.apply(null, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
blessed.program = blessed.Program = program;
|
blessed.program = blessed.Program = require('./program');
|
||||||
blessed.tput = blessed.Tput = tput;
|
blessed.tput = blessed.Tput = require('./tput');
|
||||||
blessed.widget = widget;
|
blessed.widget = require('./widget');
|
||||||
blessed.colors = colors;
|
blessed.colors = require('./colors');
|
||||||
blessed.unicode = unicode;
|
blessed.unicode = require('./unicode');
|
||||||
|
blessed.helpers = require('./helpers');
|
||||||
|
|
||||||
Object.keys(blessed.widget).forEach(function(name) {
|
blessed.helpers.sprintf = blessed.tput.sprintf;
|
||||||
blessed[name] = blessed.widget[name];
|
blessed.helpers.tryRead = blessed.tput.tryRead;
|
||||||
});
|
blessed.helpers.merge(blessed, blessed.helpers);
|
||||||
|
|
||||||
blessed.helpers = {
|
blessed.helpers.merge(blessed, blessed.widget);
|
||||||
sprintf: blessed.tput.sprintf,
|
|
||||||
merge: blessed.tput.merge,
|
|
||||||
tryRead: blessed.tput.tryRead
|
|
||||||
};
|
|
||||||
|
|
||||||
Object.keys(widget.helpers).forEach(function(key) {
|
|
||||||
blessed.helpers[key] = widget.helpers[key];
|
|
||||||
blessed[key] = widget.helpers[key];
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expose
|
* Expose
|
||||||
|
|
|
@ -2983,7 +2983,6 @@ Tput.utoa = Tput.prototype.utoa = {
|
||||||
|
|
||||||
exports = Tput;
|
exports = Tput;
|
||||||
exports.sprintf = sprintf;
|
exports.sprintf = sprintf;
|
||||||
exports.merge = merge;
|
|
||||||
exports.tryRead = tryRead;
|
exports.tryRead = tryRead;
|
||||||
|
|
||||||
module.exports = exports;
|
module.exports = exports;
|
||||||
|
|
|
@ -42,5 +42,3 @@ widget.classes.forEach(function(name) {
|
||||||
var file = name.toLowerCase();
|
var file = name.toLowerCase();
|
||||||
widget[name] = widget[file] = require('./widgets/' + file);
|
widget[name] = widget[file] = require('./widgets/' + file);
|
||||||
});
|
});
|
||||||
|
|
||||||
widget.helpers = require('./helpers');
|
|
||||||
|
|
Loading…
Reference in New Issue