Skip to content

Commit 9a19b87

Browse files
author
Brian Vaughn
committed
Combined window and global check for _schedMock
1 parent b99e3e0 commit 9a19b87

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/scheduler/src/Scheduler.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -447,16 +447,16 @@ var requestHostCallback;
447447
var cancelHostCallback;
448448
var shouldYieldToHost;
449449

450-
if (typeof window !== 'undefined' && window._schedMock) {
451-
// Dynamic injection, only for testing purposes.
452-
var windowImpl = window._schedMock;
453-
requestHostCallback = windowImpl[0];
454-
cancelHostCallback = windowImpl[1];
455-
shouldYieldToHost = windowImpl[2];
456-
getCurrentTime = windowImpl[3];
457-
} else if (typeof global !== 'undefined' && global._schedMock) {
450+
var globalValue = null;
451+
if (typeof window !== 'undefined') {
452+
globalValue = window;
453+
} else if (typeof global !== 'undefined') {
454+
globalValue = global;
455+
}
456+
457+
if (globalValue !== null && globalValue._schedMock) {
458458
// Dynamic injection, only for testing purposes.
459-
var globalImpl = global._schedMock;
459+
var globalImpl = globalValue._schedMock;
460460
requestHostCallback = globalImpl[0];
461461
cancelHostCallback = globalImpl[1];
462462
shouldYieldToHost = globalImpl[2];

0 commit comments

Comments
 (0)