mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Ensure "addEventListener" exists on "window" for "scheduler" package (#13731)
* Ensure addEventListener exists on "window"
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user