Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

Eliminate possibility of 'window is undefined' during travis test #3406

Merged
merged 1 commit into from
Sep 2, 2017
Merged
Changes from all commits
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
11 changes: 7 additions & 4 deletions lib/network/modules/CanvasRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,20 @@ class CanvasRenderer {
//
// This is not something that will happen in normal operation, but we still need
// to take it into account.
if (window === undefined) return;
//
var myWindow = window; // Grab a reference to reduce the possibility that 'window' is reset
// while running this method.
if (myWindow === undefined) return;

let timer;

if (this.requiresTimeout === true) {
// wait given number of milliseconds and perform the animation step function
timer = window.setTimeout(callback, delay);
timer = myWindow.setTimeout(callback, delay);
}
else {
if (window.requestAnimationFrame) {
timer = window.requestAnimationFrame(callback);
if (myWindow.requestAnimationFrame) {
timer = myWindow.requestAnimationFrame(callback);
}
}

Expand Down