28
28
'use strict' ;
29
29
30
30
const {
31
+ DateNow,
31
32
MathCeil,
32
33
MathFloor,
33
34
MathMax,
@@ -442,7 +443,7 @@ Interface.prototype._normalWrite = function(b) {
442
443
}
443
444
let string = this . _decoder . write ( b ) ;
444
445
if ( this . _sawReturnAt &&
445
- Date . now ( ) - this . _sawReturnAt <= this . crlfDelay ) {
446
+ DateNow ( ) - this . _sawReturnAt <= this . crlfDelay ) {
446
447
string = string . replace ( / ^ \n / , '' ) ;
447
448
this . _sawReturnAt = 0 ;
448
449
}
@@ -455,7 +456,7 @@ Interface.prototype._normalWrite = function(b) {
455
456
this . _line_buffer = null ;
456
457
}
457
458
if ( newPartContainsEnding ) {
458
- this . _sawReturnAt = string . endsWith ( '\r' ) ? Date . now ( ) : 0 ;
459
+ this . _sawReturnAt = string . endsWith ( '\r' ) ? DateNow ( ) : 0 ;
459
460
460
461
// Got one or more newlines; process into "line" events
461
462
const lines = string . split ( lineEnding ) ;
@@ -838,14 +839,14 @@ function _ttyWriteDumb(s, key) {
838
839
839
840
switch ( key . name ) {
840
841
case 'return' : // Carriage return, i.e. \r
841
- this . _sawReturnAt = Date . now ( ) ;
842
+ this . _sawReturnAt = DateNow ( ) ;
842
843
this . _line ( ) ;
843
844
break ;
844
845
845
846
case 'enter' :
846
847
// When key interval > crlfDelay
847
848
if ( this . _sawReturnAt === 0 ||
848
- Date . now ( ) - this . _sawReturnAt > this . crlfDelay ) {
849
+ DateNow ( ) - this . _sawReturnAt > this . crlfDelay ) {
849
850
this . _line ( ) ;
850
851
}
851
852
this . _sawReturnAt = 0 ;
@@ -1019,14 +1020,14 @@ Interface.prototype._ttyWrite = function(s, key) {
1019
1020
1020
1021
switch ( key . name ) {
1021
1022
case 'return' : // Carriage return, i.e. \r
1022
- this . _sawReturnAt = Date . now ( ) ;
1023
+ this . _sawReturnAt = DateNow ( ) ;
1023
1024
this . _line ( ) ;
1024
1025
break ;
1025
1026
1026
1027
case 'enter' :
1027
1028
// When key interval > crlfDelay
1028
1029
if ( this . _sawReturnAt === 0 ||
1029
- Date . now ( ) - this . _sawReturnAt > this . crlfDelay ) {
1030
+ DateNow ( ) - this . _sawReturnAt > this . crlfDelay ) {
1030
1031
this . _line ( ) ;
1031
1032
}
1032
1033
this . _sawReturnAt = 0 ;
0 commit comments