Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
brandonocasey opened this issue Apr 26, 2019 · 1 comment

Comments

@brandonocasey
Copy link
Contributor

brandonocasey commented Apr 26, 2019

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
  • The issue is is due to a this.off call that removes all of the event listeners rather than just the one that triggered the listener.
  • This issue wasn't caught because a test is incorrect
@stale
Copy link

stale bot commented Jul 16, 2019

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.

@stale stale bot added the outdated Things closed automatically by stalebot label Jul 16, 2019
@stale stale bot closed this as completed Jul 23, 2019
@brandonocasey brandonocasey added confirmed and removed outdated Things closed automatically by stalebot labels Mar 12, 2020
@brandonocasey brandonocasey reopened this Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant