@ -193,21 +193,21 @@ exports.setTimeout = function(callback, after) {
case 2 :
case 2 :
break ;
break ;
case 3 :
case 3 :
ontimeout = callback . bind ( timer , arguments [ 2 ] ) ;
ontimeout = ( ) => callback . call ( timer , arguments [ 2 ] ) ;
break ;
break ;
case 4 :
case 4 :
ontimeout = callback . bind ( timer , arguments [ 2 ] , arguments [ 3 ] ) ;
ontimeout = ( ) => callback . call ( timer , arguments [ 2 ] , arguments [ 3 ] ) ;
break ;
break ;
case 5 :
case 5 :
ontimeout =
ontimeout =
callback . bind ( timer , arguments [ 2 ] , arguments [ 3 ] , arguments [ 4 ] ) ;
( ) => callback . call ( timer , arguments [ 2 ] , arguments [ 3 ] , arguments [ 4 ] ) ;
break ;
break ;
// slow case
// slow case
default :
default :
var args = new Array ( length - 2 ) ;
var args = new Array ( length - 2 ) ;
for ( var i = 2 ; i < length ; i ++ )
for ( var i = 2 ; i < length ; i ++ )
args [ i - 2 ] = arguments [ i ] ;
args [ i - 2 ] = arguments [ i ] ;
ontimeout = callback . apply . bind ( callback , timer , args ) ;
ontimeout = ( ) => callback . apply ( timer , args ) ;
break ;
break ;
}
}
timer . _ onTimeout = ontimeout ;
timer . _ onTimeout = ontimeout ;
@ -248,20 +248,20 @@ exports.setInterval = function(callback, repeat) {
case 2 :
case 2 :
break ;
break ;
case 3 :
case 3 :
ontimeout = callback . bind ( timer , arguments [ 2 ] ) ;
ontimeout = ( ) => callback . call ( timer , arguments [ 2 ] ) ;
break ;
break ;
case 4 :
case 4 :
ontimeout = callback . bind ( timer , arguments [ 2 ] , arguments [ 3 ] ) ;
ontimeout = ( ) => callback . call ( timer , arguments [ 2 ] , arguments [ 3 ] ) ;
break ;
break ;
case 5 :
case 5 :
ontimeout =
ontimeout =
callback . bind ( timer , arguments [ 2 ] , arguments [ 3 ] , arguments [ 4 ] ) ;
( ) => callback . call ( timer , arguments [ 2 ] , arguments [ 3 ] , arguments [ 4 ] ) ;
break ;
break ;
default :
default :
var args = new Array ( length - 2 ) ;
var args = new Array ( length - 2 ) ;
for ( var i = 2 ; i < length ; i += 1 )
for ( var i = 2 ; i < length ; i += 1 )
args [ i - 2 ] = arguments [ i ] ;
args [ i - 2 ] = arguments [ i ] ;
ontimeout = callback . apply . bind ( callback , timer , args ) ;
ontimeout = ( ) => callback . apply ( timer , args ) ;
break ;
break ;
}
}
timer . _ onTimeout = wrapper ;
timer . _ onTimeout = wrapper ;
@ -273,7 +273,7 @@ exports.setInterval = function(callback, repeat) {
return timer ;
return timer ;
function wrapper ( ) {
function wrapper ( ) {
timer . _ repeat . call ( this ) ;
timer . _ repeat ( ) ;
// Timer might be closed - no point in restarting it
// Timer might be closed - no point in restarting it
if ( ! timer . _ repeat )
if ( ! timer . _ repeat )