!fn && ( fn = Popcorn.nop );
- var self = this,
+ var self = this,
+ guid = Popcorn.guid( "execCallback" ),
callback = function execCallback( event ) {
if ( this.currentTime() >= time && !callback.fired ) {
callback.fired = true;
- this.unlisten("execCallback");
+ this.unlisten("timeupdate", guid );
fn.call(self, event);
};
callback.fired = false;
+ callback.name = guid;
this.listen("timeupdate", callback);
unlisten: function( type, fn ) {
if ( this.data.events[type] && this.data.events[type][fn] ) {
- this.data.events[type][fn] = null;
+
+ delete this.data.events[type][ fn ];
+
return this;
}
QUnit.reset();
var popped = Popcorn("#video"),
- expects = 1,
+ expects = 2,
count = 0;
expect(expects);
popped.exec( 4, function () {
- ok(true, "exec function");
+ ok(true, "exec callback fired");
+ plus();
+
+
+ equal( popped.data.events.timeupdate, null, "exec callback removed");
plus();
}).currentTime(3).play();