diff options
-rw-r--r-- | lib/dom-batch.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/dom-batch.js b/lib/dom-batch.js index 3fd4e2c..e4423c3 100644 --- a/lib/dom-batch.js +++ b/lib/dom-batch.js @@ -13,6 +13,12 @@ 'use strict'; + // RequestAnimationFrame Polyfill + var raf = window.requestAnimationFrame + || window.webkitRequestAnimationFrame + || window.mozRequestAnimationFrame + || function(cb) { window.setTimeout(cb, 1000 / 60); }; + /** * Creates a new * DomBatch instance. @@ -88,8 +94,8 @@ // scheduled, don't schedule another one if (this.pending) return; - // Schedule frame - requestAnimationFrame(this.frame); + // Schedule frame (preserving context) + raf(function() { self.frame(); }); // Set flag to indicate // a frame has been scheduled |