summaryrefslogtreecommitdiffstats
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/index.js b/index.js
index 32f1693..0e8f48f 100644
--- a/index.js
+++ b/index.js
@@ -333,17 +333,24 @@
raf(function frame() {
var fn = self.frames.shift();
- // Run the frame
- if (fn) fn();
-
// If no more frames,
// stop looping
if (!self.frames.length) {
self.looping = false;
- return;
+
+ // Otherwise, schedule the
+ // next frame
+ } else {
+ raf(frame);
}
- raf(frame);
+ // Run the frame. Note that
+ // this may throw an error
+ // in user code, but all
+ // fastdom tasks are dealt
+ // with already so the code
+ // will continue to iterate
+ if (fn) fn();
});
this.looping = true;