File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change 412412 func . call ( ) ;
413413 } ;
414414 if ( AV . Promise . _isPromisesAPlusCompliant ) {
415- if ( typeof ( window ) !== 'undefined' && window . setTimeout ) {
415+ if ( typeof ( setImmediate ) !== 'undefined' && _ . isFunction ( setImmediate ) ) {
416+ runLater = setImmediate ;
417+ } else if ( typeof ( setTimeout ) !== 'undefined' && _ . isFunction ( setTimeout ) ) {
416418 runLater = function ( func ) {
417- window . setTimeout ( func , 0 ) ;
418- } ;
419- } else if ( typeof ( process ) !== 'undefined' && process . nextTick ) {
420- runLater = function ( func ) {
421- process . nextTick ( func ) ;
422- } ;
419+ setTimeout ( func , 0 ) ;
420+ }
423421 }
424422 }
425423
Original file line number Diff line number Diff line change @@ -162,7 +162,7 @@ describe('promise', function() {
162162 expect ( errors [ 2 ] ) . to . be ( 64 ) ;
163163 expect ( errors [ 3 ] ) . to . be ( 128 ) ;
164164 //should be 128 ms
165- expect ( Date . now ( ) - startDate ) . to . be . within ( 125 , 140 ) ;
165+ expect ( Date . now ( ) - startDate ) . to . be . within ( 125 , 145 ) ;
166166
167167 done ( ) ;
168168 } ) . done ( function ( ret ) {
@@ -181,7 +181,7 @@ describe('promise', function() {
181181 ] ) . catch ( function ( error ) {
182182 expect ( error ) . to . be ( 1 ) ;
183183 //should be 1 ms
184- expect ( Date . now ( ) - startDate ) . to . be . within ( 0 , 5 ) ;
184+ expect ( Date . now ( ) - startDate ) . to . be . within ( 0 , 10 ) ;
185185 setTimeout ( done , 500 ) ;
186186 } ) . done ( function ( ret ) {
187187 throw ret ;
You can’t perform that action at this time.
0 commit comments