summaryrefslogtreecommitdiffstats
path: root/lib/fastdom.js
diff options
context:
space:
mode:
authorWilson Page <wilsonpage@me.com>2013-09-25 11:12:57 -0400
committerWilson Page <wilsonpage@me.com>2013-09-25 11:12:57 -0400
commit1ff7af35a4acf8218b210f67da2a5f5598805129 (patch)
tree171fb861db796b422ceb3a57be95b6ebb9ee8f49 /lib/fastdom.js
parent9e126bde7d26bc43fbe81ec8b23e51e2187ea572 (diff)
parent3c369e994af94cbb9f805d5a35cc4b21dd53e721 (diff)
downloadfastdom-1ff7af35a4acf8218b210f67da2a5f5598805129.zip
fastdom-1ff7af35a4acf8218b210f67da2a5f5598805129.tar.gz
fastdom-1ff7af35a4acf8218b210f67da2a5f5598805129.tar.bz2
Fix merge conflicts
Diffstat (limited to 'lib/fastdom.js')
-rw-r--r--lib/fastdom.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/fastdom.js b/lib/fastdom.js
index 036a2dc..a5f98ad 100644
--- a/lib/fastdom.js
+++ b/lib/fastdom.js
@@ -197,14 +197,16 @@
* by the number of frames
* specified.
*
- * @param {Function} fn
* @param {Number} frames
+ * @param {Function} fn
* @api public
*/
- FastDom.prototype.defer = function(fn, frames) {
+ FastDom.prototype.defer = function(frames, fn, ctx) {
+ if (frames < 0) return;
+
(function wrapped() {
if (frames-- === 0) {
- try { fn(); } catch (e) {
+ try { fn.call(ctx); } catch (e) {
if (this.onError) this.onError(e);
}
} else {
@@ -266,4 +268,4 @@
window['fastdom'] = fastdom;
}
-})(window.fastdom); \ No newline at end of file
+})(window.fastdom);