28
28
'use strict' ;
29
29
30
30
const {
31
+ DateNow,
31
32
MathCeil,
32
33
MathFloor,
33
34
MathMax,
@@ -438,7 +439,7 @@ Interface.prototype._normalWrite = function(b) {
438
439
}
439
440
let string = this . _decoder . write ( b ) ;
440
441
if ( this . _sawReturnAt &&
441
- Date . now ( ) - this . _sawReturnAt <= this . crlfDelay ) {
442
+ DateNow ( ) - this . _sawReturnAt <= this . crlfDelay ) {
442
443
string = string . replace ( / ^ \n / , '' ) ;
443
444
this . _sawReturnAt = 0 ;
444
445
}
@@ -451,7 +452,7 @@ Interface.prototype._normalWrite = function(b) {
451
452
this . _line_buffer = null ;
452
453
}
453
454
if ( newPartContainsEnding ) {
454
- this . _sawReturnAt = string . endsWith ( '\r' ) ? Date . now ( ) : 0 ;
455
+ this . _sawReturnAt = string . endsWith ( '\r' ) ? DateNow ( ) : 0 ;
455
456
456
457
// Got one or more newlines; process into "line" events
457
458
const lines = string . split ( lineEnding ) ;
@@ -834,14 +835,14 @@ function _ttyWriteDumb(s, key) {
834
835
835
836
switch ( key . name ) {
836
837
case 'return' : // Carriage return, i.e. \r
837
- this . _sawReturnAt = Date . now ( ) ;
838
+ this . _sawReturnAt = DateNow ( ) ;
838
839
this . _line ( ) ;
839
840
break ;
840
841
841
842
case 'enter' :
842
843
// When key interval > crlfDelay
843
844
if ( this . _sawReturnAt === 0 ||
844
- Date . now ( ) - this . _sawReturnAt > this . crlfDelay ) {
845
+ DateNow ( ) - this . _sawReturnAt > this . crlfDelay ) {
845
846
this . _line ( ) ;
846
847
}
847
848
this . _sawReturnAt = 0 ;
@@ -1015,14 +1016,14 @@ Interface.prototype._ttyWrite = function(s, key) {
1015
1016
1016
1017
switch ( key . name ) {
1017
1018
case 'return' : // Carriage return, i.e. \r
1018
- this . _sawReturnAt = Date . now ( ) ;
1019
+ this . _sawReturnAt = DateNow ( ) ;
1019
1020
this . _line ( ) ;
1020
1021
break ;
1021
1022
1022
1023
case 'enter' :
1023
1024
// When key interval > crlfDelay
1024
1025
if ( this . _sawReturnAt === 0 ||
1025
- Date . now ( ) - this . _sawReturnAt > this . crlfDelay ) {
1026
+ DateNow ( ) - this . _sawReturnAt > this . crlfDelay ) {
1026
1027
this . _line ( ) ;
1027
1028
}
1028
1029
this . _sawReturnAt = 0 ;
0 commit comments