diff --git a/packages/scheduler/src/Scheduler.js b/packages/scheduler/src/Scheduler.js index 412f96930eb36..2c692d7dfe79c 100644 --- a/packages/scheduler/src/Scheduler.js +++ b/packages/scheduler/src/Scheduler.js @@ -468,7 +468,12 @@ var requestHostCallback; var cancelHostCallback; var getFrameDeadline; -if (typeof window === 'undefined') { +// "addEventListener" might not be available on the window object +// if this is a mocked "window" object. So we need to validate that too. +if ( + typeof window === 'undefined' || + typeof window.addEventListener !== 'function' +) { // If this accidentally gets imported in a non-browser environment, fallback // to a naive implementation. var timeoutID = -1;