mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-22 00:39:04 +00:00
automatically find screen if we are using multiple.
This commit is contained in:
parent
a9fb228f23
commit
8007aa8ee7
@ -25,10 +25,29 @@ function Node(options) {
|
||||
|
||||
options = options || {};
|
||||
this.options = options;
|
||||
|
||||
/*
|
||||
this.screen = this.screen
|
||||
|| options.screen
|
||||
|| (options.parent && options.parent.screen)
|
||||
|| require('./screen').global
|
||||
|| (function(){throw new Error('No active screen.')})();
|
||||
*/
|
||||
|
||||
var element;
|
||||
if (!options.screen && options.parent) {
|
||||
element = options.parent;
|
||||
while (element && element.type !== 'screen') {
|
||||
element = element.parent;
|
||||
}
|
||||
}
|
||||
|
||||
this.screen = this.screen
|
||||
|| options.screen
|
||||
|| element
|
||||
|| require('./screen').global
|
||||
|| (function(){throw new Error('No active screen.')})();
|
||||
|
||||
this.parent = options.parent || null;
|
||||
this.children = [];
|
||||
this.$ = this._ = this.data = {};
|
||||
|
Loading…
x
Reference in New Issue
Block a user