Closed Bug 1303722 Opened 8 years ago Closed 8 years ago

Use addEventListener(..., {once: true}) in mailnews/ and editor/

Categories

(MailNews Core :: Backend, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 52.0

People

(Reporter: aryx, Assigned: aryx)

Details

Attachments

(2 files)

Attached patch editor, v1Splinter Review
Similar to bug 1300339.

See https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener

Bug 1287706 added support for the 'once' option in addEventListener which works like an removeEventListener executed when the callback gets executed for the first time.

Advantage: add + remove in one statement, remove can't get lost

Try push: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=2dfefad3054a
Attachment #8792478 - Flags: review?(jorgk)
Comment on attachment 8792479 [details] [diff] [review]
mailnews, v1

Review of attachment 8792479 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good thx! r=mkmelin
Attachment #8792479 - Flags: review?(mkmelin+mozilla) → review+
Comment on attachment 8792478 [details] [diff] [review]
editor, v1

Review of attachment 8792478 [details] [diff] [review]:
-----------------------------------------------------------------

Reviewers also have to learn new things, this time arrow function expressions ;-)
r=jorgk

::: editor/ui/dialogs/content/EdFieldSetProps.js
@@ +70,5 @@
>        gDialog.editText.checked = false;
>        gDialog.editText.disabled = false;
>        gDialog.legendText.disabled = true;
> +      gDialog.editText.addEventListener("command",
> +        () =>  Services.prompt.alert(window, GetString("Alert"), GetString("EditTextWarning")),

Nit. Two spaces after =>
Please fix when landing.
Attachment #8792478 - Flags: review?(jorgk) → review+
https://hg.mozilla.org/comm-central/rev/c5da3041922b
https://hg.mozilla.org/comm-central/rev/2e7247627920
Landed after OK from author. Commit message fixed, white-space issue fixed.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 52.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: