Closed Bug 1156987 Opened 7 years ago Closed 5 years ago

Extract devtools event-emitter.js to toolkit

Categories

(Toolkit :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1356231

People

(Reporter: Yoric, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

At the moment, our only mechanism for observer notifications is nsIObserverService. It is useful, but it has a number drawbacks:
- it is easy to get the topic wrong;
- it is clearly not designed to let us put a JS object in a notification;
- error-handling is non-existent.

We could easily implement a mechanism that would not have these drawbacks.

As a first application, I would like to make it simple to [un]subscribe to AddonWatcher notifications.
Attached file MozReview Request: bz://1156987/Yoric (obsolete) —
/r/7413 - Bug 1156987 - Simple event mechanism

Pull down this commit:

hg pull -r 28d73a46637fcc3e1d0bbb45dea5314615f336ef https://reviewboard-hg.mozilla.org/gecko/
Attachment #8595622 - Flags: review?(dtownsend)
Comment on attachment 8595622 [details]
MozReview Request: bz://1156987/Yoric

/r/7413 - Bug 1156987 - Simple event mechanism

Pull down this commit:

hg pull -r 28d73a46637fcc3e1d0bbb45dea5314615f336ef https://reviewboard-hg.mozilla.org/gecko/
https://reviewboard.mozilla.org/r/7411/#review6175

Note that this is actually a f? rather than a r?.
Comment on attachment 8595622 [details]
MozReview Request: bz://1156987/Yoric

https://reviewboard.mozilla.org/r/7411/#review6179
Attachment #8595622 - Flags: review?(dtownsend)
Comment on attachment 8595622 [details]
MozReview Request: bz://1156987/Yoric

For avoiding duplication and consistency I think we should clean up the core code from http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/event-emitter.js and put it in toolkit/modules/EventEmitter.jsm. It has a nice API including a promise based once form.
Attachment #8595622 - Flags: feedback-
Summary: It would be nice to have a simple event mechanism → Extract devtools event-emitter.js to toolkit
Attachment #8595622 - Attachment is obsolete: true
See Also: → 1356231
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1356231
You need to log in before you can comment on or make changes to this bug.