Closed Bug 616766 Opened 14 years ago Closed 14 years ago

Convert notification events to style described in bug 593921

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: adw, Assigned: adw)

References

Details

(Whiteboard: [cherry-pick-1.0b1])

Attachments

(1 file)

Attached patch patchSplinter Review
See bug 593921 comment 8.

Currently the options object passed to the ctor is being passed as the "emitter" to onClick.  It's not true that the options object is the emitter, and besides, there are no notification objects in this API which would emit, only the global function.  So I've left out the emitter property.  If anything, the module itself is the emitter.  (And at some point the module should be a real EventEmitter so that on() and removeListener() are available.)   What do you think?
Attachment #495327 - Flags: review?(myk)
Comment on attachment 495327 [details] [diff] [review]
patch

(In reply to comment #0)
> Currently the options object passed to the ctor is being passed as the
> "emitter" to onClick.  It's not true that the options object is the emitter,
> and besides, there are no notification objects in this API which would emit,
> only the global function.  So I've left out the emitter property.  If anything,
> the module itself is the emitter.  (And at some point the module should be a
> real EventEmitter so that on() and removeListener() are available.)   What do
> you think?

Yup, that makes sense.  The `options` object is just being used to provide named parameters.  And we can make the module itself be the emitter (and a real EventEmitter) in a future change.

However, in that case, the options object shouldn't be the `this` object either.  Instead, the `this` object should be null (with a note that it should eventually be made to be the notifications module itself). r=myk with that change.
Attachment #495327 - Flags: review?(myk) → review+
Hmm, there's no way (is there?) to set `this` to null.  call()ing or apply()ing with null only sets `this` to the global scope in which call() or apply() are called, in this case the sandbox.

So I think it should be set to exports, i.e., the notifications module, especially since it's clear that the module should eventually be a real EventEmitter and the emitter of the click event.  How's that sound?
Sorry, you weren't CC'ed:

> Hmm, there's no way (is there?) to set `this` to null.  call()ing or apply()ing
> with null only sets `this` to the global scope in which call() or apply() are
> called, in this case the sandbox.
> 
> So I think it should be set to exports, i.e., the notifications module,
> especially since it's clear that the module should eventually be a real
> EventEmitter and the emitter of the click event.  How's that sound?
(In reply to comment #3)

> > So I think it should be set to exports, i.e., the notifications module,
> > especially since it's clear that the module should eventually be a real
> > EventEmitter and the emitter of the click event.  How's that sound?

Sounds good!
initial patch:
https://github.com/mozilla/addon-sdk/commit/011c945a4e3681f82f45ce44239af42268767b9b

follow-up for `this` issue:
https://github.com/mozilla/addon-sdk/commit/1234a6d224c8e9825b6a37b898b163241bb9da37
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [cherry-pick-needed]
Target Milestone: -- → 0.10
Target Milestone: 0.10 → 1.0b1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: