Browse Source

tty: require readline at top of file

No need to require it on each of those function calls.

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>
v9.x-staging
Bryan English 8 years ago
committed by Ruben Bridgewater
parent
commit
200e783e66
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 9
      lib/tty.js

9
lib/tty.js

@ -28,6 +28,7 @@ const isTTY = process.binding('tty_wrap').isTTY;
const inherits = util.inherits; const inherits = util.inherits;
const errnoException = util._errnoException; const errnoException = util._errnoException;
const errors = require('internal/errors'); const errors = require('internal/errors');
const readline = require('readline');
exports.isatty = function(fd) { exports.isatty = function(fd) {
return isTTY(fd); return isTTY(fd);
@ -117,16 +118,16 @@ WriteStream.prototype._refreshSize = function() {
// backwards-compat // backwards-compat
WriteStream.prototype.cursorTo = function(x, y) { WriteStream.prototype.cursorTo = function(x, y) {
require('readline').cursorTo(this, x, y); readline.cursorTo(this, x, y);
}; };
WriteStream.prototype.moveCursor = function(dx, dy) { WriteStream.prototype.moveCursor = function(dx, dy) {
require('readline').moveCursor(this, dx, dy); readline.moveCursor(this, dx, dy);
}; };
WriteStream.prototype.clearLine = function(dir) { WriteStream.prototype.clearLine = function(dir) {
require('readline').clearLine(this, dir); readline.clearLine(this, dir);
}; };
WriteStream.prototype.clearScreenDown = function() { WriteStream.prototype.clearScreenDown = function() {
require('readline').clearScreenDown(this); readline.clearScreenDown(this);
}; };
WriteStream.prototype.getWindowSize = function() { WriteStream.prototype.getWindowSize = function() {
return [this.columns, this.rows]; return [this.columns, this.rows];

Loading…
Cancel
Save