videojs / video.js

Video.js - open source HTML5 video player
https://videojs.com
Other
38.05k stars 7.45k forks source link

evented mixin `one` when not targeting self only triggers one time for multiple events #5962

Open brandonocasey opened 5 years ago

brandonocasey commented 5 years ago

The evented one function only triggers one time with multiple listener, when the mixin object is not targeting itself.

Evented Mixin on self

let triggered = 0;
let el = new Component();

const listener = () => triggered++;
el.one(['a', 'b'], listener);

el.trigger('a');
// triggered is 1
el.trigger('b');
// triggered is 2

Evented Mixin on other

let triggered = 0;
let el = new Component();
let el2 = new Component();
el.one(el2, ['a', 'b'], listener);

el2.trigger('a');
// triggered is 1
el2.trigger('b');
// triggered is still 1
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.