Closed Bug 647654 Opened 13 years ago Closed 12 years ago

[SMILE] Avoid binding this._event N times by doing it once in the constructor.

Categories

(SeaMonkey :: General, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
seamonkey2.12

People

(Reporter: philip.chee, Assigned: sgautherie)

References

()

Details

Attachments

(1 file)

From Bug 647571 Comment 2:
> neil@parkwaycc.co.uk      2011-04-03 13:15:37 PDT
> 
> [In theory it's possible to avoid binding this._event N times by doing it once
> in the constructor. Followup bug perhaps?]
What is the syntax to do this?

Ftr, there are 2 occurrences:
{
143       this._cleanup[aType] = this._event.bind(this),
230       this._cleanup[aType] = this._event.bind(this),
}
Severity: normal → minor
Something like

__event : function win_event(aEvent) {

...

this._event = this.__event.bind(this);

...

this._cleanup[aType] = this._event,
Should be like this.
(Untested.)
Assignee: nobody → sgautherie.bz
Status: NEW → ASSIGNED
Attachment #627134 - Flags: review?(neil)
(In reply to Serge Gautherie from comment #3)
> (Untested.)
Do we have unit tests that I can run locally for this?
Comment on attachment 627134 [details] [diff] [review]
(Av1) smileApplication.js: Bind '_event()' once for all
[Checked in: See comment 7]

>+  // Define '_event()' as binded once for all.
Nit: past tense of 'bind' is 'bound', not 'binded'.
Attachment #627134 - Flags: review?(neil) → review+
Comment on attachment 627134 [details] [diff] [review]
(Av1) smileApplication.js: Bind '_event()' once for all
[Checked in: See comment 7]

http://hg.mozilla.org/comm-central/rev/67501405df7b
Av1, with comment 6 suggestion(s).
Attachment #627134 - Attachment description: (Av1) smileApplication.js: Bind '_event()' once for all → (Av1) smileApplication.js: Bind '_event()' once for all [Checked in: See comment 7]
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
Target Milestone: --- → seamonkey2.12
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: