From 1795cd93d6cf831cc10a60aee29885ef3e783daa Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 31 Jan 2015 12:26:19 -0800 Subject: [PATCH] use setImmediate everywhere. --- lib/program.js | 4 +++- lib/widget.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/program.js b/lib/program.js index 2634f20..54f7a08 100644 --- a/lib/program.js +++ b/lib/program.js @@ -17,6 +17,8 @@ var Tput = require('./tput') , colors = require('./colors') , slice = Array.prototype.slice; +var nextTick = global.setImmediate || process.nextTick.bind(process); + /** * Program */ @@ -1283,7 +1285,7 @@ Program.prototype._buffer = function(text) { this._buf = text; - process.nextTick(this._flush); + nextTick(this._flush); }; Program.prototype.flush = function(text) { diff --git a/lib/widget.js b/lib/widget.js index a2d13de..8313264 100644 --- a/lib/widget.js +++ b/lib/widget.js @@ -6496,7 +6496,7 @@ function Terminal(options) { }); this.on('resize', function() { - setImmediate(function() { + nextTick(function() { self.term.resize(self.width - self.iwidth, self.height - self.iheight); }); });