From e506412f93e5a4d39e57799af790b139a1578f5f Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 22 Jul 2015 08:07:52 -0700 Subject: [PATCH] rename program.list. --- lib/program.js | 26 +++++++++++++------------- lib/widgets/screen.js | 14 +++++++------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/program.js b/lib/program.js index 7feb3ab..48dd7ff 100644 --- a/lib/program.js +++ b/lib/program.js @@ -117,15 +117,15 @@ Program.global = null; Program.total = 0; -Program.list = []; +Program.instances = []; Program.bind = function(program) { if (!Program.global) { Program.global = program; } - if (!~Program.list.indexOf(program)) { - Program.list.push(program); + if (!~Program.instances.indexOf(program)) { + Program.instances.push(program); Program.total++; } @@ -133,7 +133,7 @@ Program.bind = function(program) { Program._bound = true; unshiftEvent(process, 'exit', function() { - Program.list.forEach(function(program) { + Program.instances.forEach(function(program) { // Ensure the buffer is flushed (it should // always be at this point, but who knows). program.flush(); @@ -145,7 +145,7 @@ Program.bind = function(program) { // Potentially reset window title on exit: // unshiftEvent(process, 'exit', function() { - // Program.list.forEach(function(program) { + // Program.instances.forEach(function(program) { // if (program._originalTitle) { // program.setTitle(program._originalTitle); // } @@ -363,7 +363,7 @@ Program.prototype._listenInput = function() { key.full = name; - Program.list.forEach(function(program) { + Program.instances.forEach(function(program) { if (program.input !== self.input) return; program.emit('keypress', ch, key); program.emit('key ' + name, ch, key); @@ -371,7 +371,7 @@ Program.prototype._listenInput = function() { }); this.input.on('data', function(data) { - Program.list.forEach(function(program) { + Program.instances.forEach(function(program) { if (program.input !== self.input) return; program.emit('data', data); }); @@ -381,7 +381,7 @@ Program.prototype._listenInput = function() { this.on('newListener', function fn(type) { if (type === 'keypress' || type === 'mouse') { - Program.list.forEach(function(program) { + Program.instances.forEach(function(program) { if (program.input !== self.input) return; program.removeListener('newListener', fn); if (program.input.setRawMode && !program.input.isRaw) { @@ -394,7 +394,7 @@ Program.prototype._listenInput = function() { this.on('newListener', function fn(type) { if (type === 'mouse') { - Program.list.forEach(function(program) { + Program.instances.forEach(function(program) { if (program.input !== self.input) return; program.removeListener('newListener', fn); program.bindMouse(); @@ -414,7 +414,7 @@ Program.prototype._listenOutput = function() { // Output function resize() { - Program.list.forEach(function(program) { + Program.instances.forEach(function(program) { if (program.output !== self.output) return; program.cols = program.output.columns; program.rows = program.output.rows; @@ -423,7 +423,7 @@ Program.prototype._listenOutput = function() { } this.output.on('resize', function() { - Program.list.forEach(function(program) { + Program.instances.forEach(function(program) { if (program.output !== self.output) return; if (!program.options.resizeTimeout) { return resize(); @@ -441,9 +441,9 @@ Program.prototype._listenOutput = function() { }; Program.prototype.destroy = function() { - var index = Program.list.indexOf(this); + var index = Program.instances.indexOf(this); if (~index) { - Program.list.splice(index, 1); + Program.instances.splice(index, 1); Program.total--; if (Program.total === 0) { Program.global = null; diff --git a/lib/widgets/screen.js b/lib/widgets/screen.js index 43342eb..57532ac 100644 --- a/lib/widgets/screen.js +++ b/lib/widgets/screen.js @@ -186,7 +186,7 @@ Screen.global = null; Screen.total = 0; -Screen.list = []; +Screen.instances = []; Screen.signals = true; @@ -195,8 +195,8 @@ Screen.bind = function(screen) { Screen.global = screen; } - if (!~Screen.list.indexOf(screen)) { - Screen.list.push(screen); + if (!~Screen.instances.indexOf(screen)) { + Screen.instances.push(screen); Screen.total++; } @@ -207,7 +207,7 @@ Screen.bind = function(screen) { if (process.listeners('uncaughtException').length > Screen.total) { return; } - Screen.list.slice().forEach(function(screen) { + Screen.instances.slice().forEach(function(screen) { screen.destroy(); }); err = err || new Error('Uncaught Exception.'); @@ -233,7 +233,7 @@ Screen.bind = function(screen) { } process.on('exit', function() { - Screen.list.slice().forEach(function(screen) { + Screen.instances.slice().forEach(function(screen) { screen.destroy(); }); }); @@ -381,9 +381,9 @@ Screen.prototype.postEnter = function() { Screen.prototype.destroy = function() { this.leave(); - var index = Screen.list.indexOf(this); + var index = Screen.instances.indexOf(this); if (~index) { - Screen.list.splice(index, 1); + Screen.instances.splice(index, 1); Screen.total--; if (Screen.total === 0) { Screen.global = null;