Skip to content

Commit 03c9a58

Browse files
committedMar 12, 2022
Revert "Fix setImmediate bug in fake-timers (#125)"
This reverts commit c161f25.
1 parent c8b8346 commit 03c9a58

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎src/index.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import allSettled from './allSettled';
44
// Store setTimeout reference so promise-polyfill will be unaffected by
55
// other code modifying setTimeout (like sinon.useFakeTimers())
66
var setTimeoutFunc = setTimeout;
7-
// @ts-ignore
8-
var setImmediateFunc = typeof setImmediate !== 'undefined' ? setImmediate : null;
97

108
function isArray(x) {
119
return Boolean(x && typeof x.length !== 'undefined');
@@ -239,10 +237,10 @@ Promise.race = function(arr) {
239237
// Use polyfill for setImmediate for performance gains
240238
Promise._immediateFn =
241239
// @ts-ignore
242-
(typeof setImmediateFunc === 'function' &&
240+
(typeof setImmediate === 'function' &&
243241
function(fn) {
244242
// @ts-ignore
245-
setImmediateFunc(fn);
243+
setImmediate(fn);
246244
}) ||
247245
function(fn) {
248246
setTimeoutFunc(fn, 0);

0 commit comments

Comments
 (0)
Please sign in to comment.