X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-utils.js;h=6ca025fe0a83c0aaa91dc5a38ca5bbbd1f3879bc;hb=6814f34bd42b51019b3adb525ca3ce71f1f9fb63;hp=10a393cfb2c6948e5d1cf7dac085ab2a595129d9;hpb=d91ba598b82c927945744c7041dc05500b5545b3;p=dygraphs.git diff --git a/dygraph-utils.js b/dygraph-utils.js index 10a393c..6ca025f 100644 --- a/dygraph-utils.js +++ b/dygraph-utils.js @@ -816,7 +816,9 @@ Dygraph.createIterator = function(array, start, length, opt_predicate) { // Shim layer with setTimeout fallback. // From: http://paulirish.com/2011/requestanimationframe-for-smart-animating/ -Dygraph.requestAnimFrame = (function(){ +// Should be called with the window context: +// Dygraph.requestAnimFrame.call(window, function() {}) +Dygraph.requestAnimFrame = (function() { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || @@ -841,7 +843,7 @@ Dygraph.requestAnimFrame = (function(){ * @private */ Dygraph.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis, - cleanupFn) { + cleanupFn) { var frameNumber = 0; var previousFrameNumber; var startTime = new Date().getTime(); @@ -854,7 +856,7 @@ Dygraph.repeatAndCleanup = function(repeatFn, maxFrames, framePeriodInMillis, (function loop() { if (frameNumber >= maxFrames) return; - Dygraph.requestAnimFrame(function() { + Dygraph.requestAnimFrame.call(window, function() { // Determine which frame to draw based on the delay so far. Will skip // frames if necessary. var currentTime = new Date().getTime();