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

Should .off(event, listener) remove all occurences? #4

Open
ryanve opened this issue May 5, 2014 · 1 comment
Open

Should .off(event, listener) remove all occurences? #4

ryanve opened this issue May 5, 2014 · 1 comment

Comments

@ryanve
Copy link
Owner

ryanve commented May 5, 2014

I'm not crazy about energy().off(event, listener, quota?) having the optional quota. Without the documentation it's hard to know what it is. It only applies to the rare case of having the same listener listening to the same event more than once. I'd like to decide on the more useful behavior and remove the option, or maybe provide a separate function.

Node's (new EventEmitter).off(event, listener) removes only the most recent occuence. I was surprised to discover that. My guess was that it'd remove all occurences like how jQuery({}).off(event, listener) does.

@ryanve ryanve changed the title Should .off(event, listener) remove all occurrences of listener? .off(event, listener) behavior for multiple occurrences of listener May 5, 2014
@ryanve ryanve changed the title .off(event, listener) behavior for multiple occurrences of listener .off(event, listener) behavior when listener occurs multiple times May 5, 2014
@ryanve ryanve changed the title .off(event, listener) behavior when listener occurs multiple times .off(event, listener) for multiple listener occurences May 5, 2014
@ryanve ryanve changed the title .off(event, listener) for multiple listener occurences .off(event, listener) multiple listener occurrence behavior May 5, 2014
@ryanve ryanve changed the title .off(event, listener) multiple listener occurrence behavior Should .off(event, listener) remove all occurences May 5, 2014
@ryanve ryanve changed the title Should .off(event, listener) remove all occurences Should .off(event, listener) remove all occurences? May 5, 2014
@ryanve
Copy link
Owner Author

ryanve commented May 5, 2014

One idea I had to handle this is to add .addListener and .removeListener that are fully compatible with EventEmitter where they're aliases for .on and .off. We could have .removeListener remove 1 and .off remove all. .addListener could be an alias for .on like in EventEmitter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant