Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Create "off" as an alias for "removeEventListener" #5352

Closed
donaldpipowitch opened this issue Apr 23, 2013 · 6 comments
Closed

Create "off" as an alias for "removeEventListener" #5352

donaldpipowitch opened this issue Apr 23, 2013 · 6 comments

Comments

@donaldpipowitch
Copy link

Hi *,

Just a small feature request: Since on is an alias for addEventListener it would be handy and more consistent if removeEventListener had off as an alias.
(At least I tried off first.)

@bnoordhuis
Copy link
Member

Similar suggestions have been made in the past. However, the events module is frozen (and events.EventEmitter in particular), no further methods or properties will be added.

@donaldpipowitch
Copy link
Author

Oh, I searched for this problem, but couldn't found a related issue. Sorry for that.
I thought frozen would just preserve the existing API, but is still open for additions. Very, very sad.

@bnoordhuis
Copy link
Member

Additions when the API is frozen are - in theory - possible but EventEmitter is a special case. Since everyone and his dog inherits from it, adding a new property means everything all of a sudden grows a new property. The 'domain' property in v0.8 was painful enough for some to not want to repeat that.

@donaldpipowitch
Copy link
Author

Thank you for your answers. If this should ever be considered again, it would be great. I really would like to hear some arguments from people who do not want this addition. (Expect the argument you said.)

Funny side note: There is a whole Node module which has only one purpose - create a tiny polyfill for off. Not that I would install a complete module for a one-liner :)

@Mithgol
Copy link

Mithgol commented Apr 23, 2013

But I would (if I ever need off as an alias for removeListener), so thank you for the hyperlink and for the information.

@donaldpipowitch
Copy link
Author

I'm glad I could help!

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

No branches or pull requests

3 participants