Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update conditional as per feedback
  • Loading branch information
trueadm committed Sep 26, 2018
commit f968b8418be7846cb43d71c008c992af5d8cd3d0
12 changes: 5 additions & 7 deletions packages/scheduler/src/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,9 @@ 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 Expand Up @@ -573,12 +575,8 @@ if (typeof window === 'undefined') {
}
};
// Assumes that we have addEventListener in this environment. Might need
// something better for old IE. Furthermore, "addEventListener" might not
// be available on the window object (if this is a RN mocked window),
// so we should check that it's a function before attaching the listener.
if (typeof window.addEventListener === 'function') {
window.addEventListener('message', idleTick, false);
}
// something better for old IE.
window.addEventListener('message', idleTick, false);

var animationTick = function(rafTime) {
isAnimationFrameScheduled = false;
Expand Down