Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure "addEventListener" exists on "window" for "scheduler" package #13731

Merged
merged 4 commits into from
Sep 26, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/scheduler/src/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down