We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f678c48 commit 928db70Copy full SHA for 928db70
packages/scheduler/src/Scheduler.js
@@ -468,7 +468,12 @@ var requestHostCallback;
468
var cancelHostCallback;
469
var getFrameDeadline;
470
471
-if (typeof window === 'undefined') {
+// "addEventListener" might not be available on the window object
472
+// if this is a mocked "window" object. So we need to validate that too.
473
+if (
474
+ typeof window === 'undefined' ||
475
+ typeof window.addEventListener !== 'function'
476
+) {
477
// If this accidentally gets imported in a non-browser environment, fallback
478
// to a naive implementation.
479
var timeoutID = -1;
0 commit comments