diff options
author | Bryan English <bryan@bryanenglish.com> | 2017-09-27 23:18:41 -0700 |
---|---|---|
committer | Myles Borins <myles.borins@gmail.com> | 2017-10-25 04:09:46 -0400 |
commit | 88b9572d76aaef779308c2a32b994d3d6d6b7b0d (patch) | |
tree | 4e936acd2436a6b346a8f06594c9986a4b43bef2 /lib | |
parent | cdba9890a184079f5864d010f0de7dbbd321f6df (diff) | |
download | node-new-88b9572d76aaef779308c2a32b994d3d6d6b7b0d.tar.gz |
tty: require readline at top of file
No need to require it on each of those function calls.
Backport-PR-URL: https://github.com/nodejs/node/pull/16264
PR-URL: https://github.com/nodejs/node/pull/15647
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tty.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/tty.js b/lib/tty.js index e836beb900..08977115c6 100644 --- a/lib/tty.js +++ b/lib/tty.js @@ -6,6 +6,7 @@ const TTY = process.binding('tty_wrap').TTY; const isTTY = process.binding('tty_wrap').isTTY; const inherits = util.inherits; const errnoException = util._errnoException; +const readline = require('readline'); exports.isatty = function(fd) { @@ -90,16 +91,16 @@ WriteStream.prototype._refreshSize = function() { // backwards-compat WriteStream.prototype.cursorTo = function(x, y) { - require('readline').cursorTo(this, x, y); + readline.cursorTo(this, x, y); }; WriteStream.prototype.moveCursor = function(dx, dy) { - require('readline').moveCursor(this, dx, dy); + readline.moveCursor(this, dx, dy); }; WriteStream.prototype.clearLine = function(dir) { - require('readline').clearLine(this, dir); + readline.clearLine(this, dir); }; WriteStream.prototype.clearScreenDown = function() { - require('readline').clearScreenDown(this); + readline.clearScreenDown(this); }; WriteStream.prototype.getWindowSize = function() { return [this.columns, this.rows]; |