Alias sdk/events to `events` for node



5 years ago
a year ago


(Reporter: jsantell, Unassigned)


Firefox Tracking Flags

(Not tracked)



(1 attachment)

Priority: -- → P3
Created attachment 8357457 [details] [review]
node's event

* Moved `sdk/event/target` to `node/events` -- changed exposed object from `EventTarget` to `EventEmitter`. No deprecation until we're ready.
* Added `removeAllListeners(type)` to EventEmitter. Similar to off(target) and off(target, type).
* Added `listeners(type)` to return listener count
* Added `emitter.emit` return boolean indicating if there were any listeners listening
* Added static method `EventEmitter.listenerCount()`, same as listeners(type)
* Added events 'newListener' and 'removeListener' to be fired upon adding/removing listeners.
* Added alias for `on`: `addListener`
* Node's `setMaxListeners()` was noop'd, but not implemented here -- may incur too much overhead.

All this is for node parity.
Attachment #8357457 - Flags: review?(evold)
Comment on attachment 8357457 [details] [review]
node's event

It looks like this patch will add `addListener` api to everything that implements EventTarget.  Irakli are you ok with this?
Attachment #8357457 - Flags: feedback?(rFobic)
Assignee: nobody → jsantell
For clarity, this will add all of these methods to anything that implements EventTarget (which is alised to node EventEmitter)
Comment on attachment 8357457 [details] [review]
node's event

Assuming that Irakli says the api change is alright r+
Attachment #8357457 - Flags: review?(evold) → review+
Comment on attachment 8357457 [details] [review]
node's event

Jordan we had a chat about it on IRC and I had some arguments against this change. This does not means I can't be convinced otherwise, but right now
I'm saying no as I don't see a much value in doing this.

Feel free to followup and convince me I'm wrong if you still disagree.
Attachment #8357457 - Flags: feedback?(rFobic) → feedback-
Nah, we're in agreement -- putting this on hold until we figure out what to do with these node modules
Unassigning myself from bugs I haven't gotten around to
Assignee: jsantell → nobody
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.