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: nodejs/node#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>
  • Loading branch information
bengl authored and addaleax committed Oct 4, 2017
1 parent 4b0c8d7 commit b426dac
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 b426dac

Please sign in to comment.