diff options
author | Wilson Page <wilsonpage@me.com> | 2013-08-26 21:51:24 +0100 |
---|---|---|
committer | Wilson Page <wilsonpage@me.com> | 2013-08-26 21:51:24 +0100 |
commit | 3bc9f234f3781199e681521c2fb223bd81e5a61c (patch) | |
tree | 90b841fc6e1d584e914cad5b818a2259edc0e24e /lib/dom-batch.js | |
parent | ae868e471994a191ecbfc9a3ff58f8a5962af978 (diff) | |
download | fastdom-3bc9f234f3781199e681521c2fb223bd81e5a61c.zip fastdom-3bc9f234f3781199e681521c2fb223bd81e5a61c.tar.gz fastdom-3bc9f234f3781199e681521c2fb223bd81e5a61c.tar.bz2 |
requestAnimationFrame polyfill
Diffstat (limited to 'lib/dom-batch.js')
-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 |