Status

Add-on SDK
General
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: irakli, Assigned: irakli)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

In many cases we set an event listener that is removes itself on a first call. I think it will be extremely useful to implement following API:

eventEmitter.once('EventType', listener).

Also similar thing have recently been added to [nodejs](http://nodejs.org/docs/v0.4.1/api/events.html#emitter.once). As a matter of fact all other major frameworks also provide APIs to do similar thing.

In addition I would also propose to implement following low lever module 'api-utils/dom/events' (as this seems to be very useful with regular dom events):

require('dom/events').on(element, 'load', onLoad, [capture=false])
require('dom/events').removeListener(element, 'load', onLoad, [capture=false])
require('dom/events').once(element, 'load', onLoadOnly, [capture=false])
Created attachment 515173 [details]
Pointer to pull request
Attachment #515173 - Flags: review?(myk)
Comment on attachment 515173 [details]
Pointer to pull request

Just a few minor issues, as noted in the pull request.
Attachment #515173 - Flags: review?(myk) → review-
Created attachment 519107 [details]
Pointer to pull request
Attachment #519107 - Flags: review?(myk)
Assignee: nobody → rFobic
Attachment #519107 - Flags: review?(myk) → review+
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.