Skip to content

Commit

Permalink
Hang onto and friends so that flush behaves w/ stubbed timers. Fixes …
Browse files Browse the repository at this point in the history
…#153
  • Loading branch information
Ian MacLeod committed Apr 28, 2015
1 parent eba1df7 commit 51a422d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7429,6 +7429,11 @@ window.addEventListener('unload', function(event) {
*/
(function() {

// Make sure that we use native timers, in case they're being stubbed out.
var setInterval = window.setInterval;
var setTimeout = window.setTimeout;
var requestAnimationFrame = window.requestAnimationFrame;

/**
* Runs `stepFn`, catching any error and passing it to `callback` (Node-style).
* Otherwise, calls `callback` with no arguments on success.
Expand Down
5 changes: 5 additions & 0 deletions browser/environment/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
*/
(function() {

// Make sure that we use native timers, in case they're being stubbed out.
var setInterval = window.setInterval;
var setTimeout = window.setTimeout;
var requestAnimationFrame = window.requestAnimationFrame;

/**
* Runs `stepFn`, catching any error and passing it to `callback` (Node-style).
* Otherwise, calls `callback` with no arguments on success.
Expand Down

0 comments on commit 51a422d

Please sign in to comment.