[Bug 28455] New: Add a method to add a one-time event listener
[email protected] Thu, 09 Apr 2015 21:38:06 +0000
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <[email protected]/Bugs/Public/> |
https://www.w3.org/Bugs/Public/show_bug.cgi?id=28455
Bug ID: 28455
Summary: Add a method to add a one-time event listener
Product: WebAppsWG
Version: unspecified
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: P2
Component: DOM
Assignee: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected], [email protected]
It seems to be a common pattern to have code like:
element.addEventListener("click", function onClick(event) {
element.removeEventListener("click", onClick);
...
});
jQuery has method ".one()" to simplify this pattern.
I think it would be great if DOM directly includes a method for this in
EventTarget. Probably this method could be:
void listenForNextEvent(DOMString type, EventListener? callback, optional
boolean capture = false);
--
You are receiving this mail because:
You are on the CC list for the bug.