mirror of
https://github.com/videojs/video.js.git
synced 2025-01-29 11:23:10 +02:00
Close GH-659: Allow event handlers registered with one() to be removed with off().. Fixes #658
This commit is contained in:
parent
a809954495
commit
334ff59ff0
@ -329,8 +329,10 @@ vjs.trigger = function(elem, event) {
|
||||
* @return {[type]}
|
||||
*/
|
||||
vjs.one = function(elem, type, fn) {
|
||||
vjs.on(elem, type, function(){
|
||||
vjs.off(elem, type, arguments.callee);
|
||||
var func = function(){
|
||||
vjs.off(elem, type, func);
|
||||
fn.apply(this, arguments);
|
||||
});
|
||||
};
|
||||
func.guid = fn.guid = fn.guid || vjs.guid++;
|
||||
vjs.on(elem, type, func);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user