peerjs
peerjs copied to clipboard
Implement connection as EventTarget (allow removing listener)
Do you have any plans to implement the connection as an EventTarget so you can use .addEventListener
?
I'd like to have a way to unsubscribe one listening function and replace it with another listening function.
Funny you should ask that. Yes, I do.
It’s just chesterton’s EventEmitter
. Is there a good reason, not to use the native EventTarget
? I want to unterstand why the original implementors didn’t use the native one, before I make any changes.
In the meantime, you should be able to remove listeners now: https://github.com/primus/eventemitter3/blob/acad2eb2e47b7fd44dbb3f61a930cada3b2c8b39/index.d.ts#L60-L74