Skip to content

Commit

Permalink
tty: require readline at top of file
Browse files Browse the repository at this point in the history
No need to require it on each of those function calls.

PR-URL: #15647
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jeremiah Senkpiel <[email protected]>
  • Loading branch information
bengl authored and BridgeAR committed Oct 1, 2017
1 parent 2adf680 commit 200e783
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const isTTY = process.binding('tty_wrap').isTTY;
const inherits = util.inherits;
const errnoException = util._errnoException;
const errors = require('internal/errors');
const readline = require('readline');

exports.isatty = function(fd) {
return isTTY(fd);
Expand Down Expand Up @@ -117,16 +118,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];
Expand Down

0 comments on commit 200e783

Please sign in to comment.