Skip to content

Commit

Permalink
Combined window and global check for _schedMock
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Nov 30, 2018
1 parent b99e3e0 commit 9a19b87
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/scheduler/src/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,16 +447,16 @@ var requestHostCallback;
var cancelHostCallback;
var shouldYieldToHost;

if (typeof window !== 'undefined' && window._schedMock) {
// Dynamic injection, only for testing purposes.
var windowImpl = window._schedMock;
requestHostCallback = windowImpl[0];
cancelHostCallback = windowImpl[1];
shouldYieldToHost = windowImpl[2];
getCurrentTime = windowImpl[3];
} else if (typeof global !== 'undefined' && global._schedMock) {
var globalValue = null;
if (typeof window !== 'undefined') {
globalValue = window;
} else if (typeof global !== 'undefined') {
globalValue = global;
}

if (globalValue !== null && globalValue._schedMock) {
// Dynamic injection, only for testing purposes.
var globalImpl = global._schedMock;
var globalImpl = globalValue._schedMock;
requestHostCallback = globalImpl[0];
cancelHostCallback = globalImpl[1];
shouldYieldToHost = globalImpl[2];
Expand Down

0 comments on commit 9a19b87

Please sign in to comment.