summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilson Page <wilsonpage@me.com>2013-09-19 17:03:58 +0100
committerWilson Page <wilsonpage@me.com>2013-09-19 17:03:58 +0100
commit4905c89e4ed08ed9b05cc583fdc65e64ca8207b0 (patch)
tree20fd308aff6d1082088e55eb2b9a3f1a2556bae5
parented31cefdd0a1becedd35556a36d0b699364a81ad (diff)
downloadfastdom-4905c89e4ed08ed9b05cc583fdc65e64ca8207b0.zip
fastdom-4905c89e4ed08ed9b05cc583fdc65e64ca8207b0.tar.gz
fastdom-4905c89e4ed08ed9b05cc583fdc65e64ca8207b0.tar.bz2
Catch errors on defer as well as batch flush
-rw-r--r--lib/fastdom.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/fastdom.js b/lib/fastdom.js
index 1bab13b..036a2dc 100644
--- a/lib/fastdom.js
+++ b/lib/fastdom.js
@@ -160,8 +160,8 @@
job = this.jobs[id];
ctx = job.ctx || this;
delete this.jobs[id];
- try { job.fn.call(ctx); } catch (err) {
- if (this.onError) this.onError(err);
+ try { job.fn.call(ctx); } catch (e) {
+ if (this.onError) this.onError(e);
}
}
};
@@ -204,7 +204,9 @@
FastDom.prototype.defer = function(fn, frames) {
(function wrapped() {
if (frames-- === 0) {
- try { fn(); } catch (e) {}
+ try { fn(); } catch (e) {
+ if (this.onError) this.onError(e);
+ }
} else {
raf(wrapped);
}