diff options
author | Wilson Page <wilsonpage@me.com> | 2013-09-19 17:03:58 +0100 |
---|---|---|
committer | Wilson Page <wilsonpage@me.com> | 2013-09-19 17:03:58 +0100 |
commit | 4905c89e4ed08ed9b05cc583fdc65e64ca8207b0 (patch) | |
tree | 20fd308aff6d1082088e55eb2b9a3f1a2556bae5 | |
parent | ed31cefdd0a1becedd35556a36d0b699364a81ad (diff) | |
download | fastdom-4905c89e4ed08ed9b05cc583fdc65e64ca8207b0.zip fastdom-4905c89e4ed08ed9b05cc583fdc65e64ca8207b0.tar.gz fastdom-4905c89e4ed08ed9b05cc583fdc65e64ca8207b0.tar.bz2 |
Catch errors on defer as well as batch flush
-rw-r--r-- | lib/fastdom.js | 8 |
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); } |