primus / eventemitter3

EventEmitter3 - Because there's also a number 2. And we're faster.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

.off to throw warning if event can't be found

fyyyyy opened this issue · comments

https://github.com/primus/eventemitter3/blob/master/index.js#L254
Currently .off does not fire a warning or error if the event cant be found. Since e.g. phaser game engine is using this library, this can create situations where you have memory leaks if you are not careful.
Maybe this could be made configurable aka strict mode

It works like https://nodejs.org/api/events.html#events_emitter_removelistener_eventname_listener, no warning or error is thrown if the listener is not registered.

Closing due to inactivity.

I mean this to be a feature request to change the functionality, so it throws a warning if an event cant be found. That would make memory management e.g. in games easier.