From: rwldrn Date: Thu, 6 Jan 2011 19:28:12 +0000 (-0500) Subject: [#240] Popcorn.exec fires more than once per binding X-Git-Tag: v0.2~7^2~2^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=cd19946d3e15222a191291fd27f8eff0a98de992;p=popcorn-js.git [#240] Popcorn.exec fires more than once per binding --- diff --git a/popcorn.js b/popcorn.js index 9c8f11a..25315f6 100644 --- a/popcorn.js +++ b/popcorn.js @@ -295,26 +295,24 @@ !fn && ( fn = Popcorn.nop ); - var timer = 0, - self = this, + var self = this, callback = function execCallback( event ) { - if ( this.currentTime() >= time && !timer ) { + if ( this.currentTime() >= time && !callback.fired ) { - fn.call(self, event); + callback.fired = true; this.unlisten("execCallback"); - timer++; + fn.call(self, event); + } }; - + callback.fired = false; this.listen("timeupdate", callback); - - return this; }, removePlugin: function( name ) {