@@ -77,8 +77,6 @@ function allSettled(arr) {
77
77
// Store setTimeout reference so promise-polyfill will be unaffected by
78
78
// other code modifying setTimeout (like sinon.useFakeTimers())
79
79
var setTimeoutFunc = setTimeout ;
80
- // @ts -ignore
81
- var setImmediateFunc = typeof setImmediate !== 'undefined' ? setImmediate : null ;
82
80
83
81
function isArray ( x ) {
84
82
return Boolean ( x && typeof x . length !== 'undefined' ) ;
@@ -312,10 +310,10 @@ Promise.race = function(arr) {
312
310
// Use polyfill for setImmediate for performance gains
313
311
Promise . _immediateFn =
314
312
// @ts -ignore
315
- ( typeof setImmediateFunc === 'function' &&
313
+ ( typeof setImmediate === 'function' &&
316
314
function ( fn ) {
317
315
// @ts -ignore
318
- setImmediateFunc ( fn ) ;
316
+ setImmediate ( fn ) ;
319
317
} ) ||
320
318
function ( fn ) {
321
319
setTimeoutFunc ( fn , 0 ) ;
@@ -350,13 +348,10 @@ var globalNS = (function() {
350
348
// https://github.com/taylorhakes/promise-polyfill/issues/114
351
349
if ( typeof globalNS [ 'Promise' ] !== 'function' ) {
352
350
globalNS [ 'Promise' ] = Promise ;
353
- } else {
354
- if ( ! globalNS . Promise . prototype [ 'finally' ] ) {
355
- globalNS . Promise . prototype [ 'finally' ] = finallyConstructor ;
356
- }
357
- if ( ! globalNS . Promise . allSettled ) {
358
- globalNS . Promise . allSettled = allSettled ;
359
- }
351
+ } else if ( ! globalNS . Promise . prototype [ 'finally' ] ) {
352
+ globalNS . Promise . prototype [ 'finally' ] = finallyConstructor ;
353
+ } else if ( ! globalNS . Promise . allSettled ) {
354
+ globalNS . Promise . allSettled = allSettled ;
360
355
}
361
356
362
357
} ) ) ) ;
0 commit comments