Alias sdk/events to `events` for node

RESOLVED INCOMPLETE

Status

P3
normal
RESOLVED INCOMPLETE
5 years ago
a year ago

People

(Reporter: jsantell, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(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)
(Reporter)

Updated

5 years ago
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
https://bugzilla.mozilla.org/show_bug.cgi?id=1399562
Status: NEW → RESOLVED
Last Resolved: a year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.