- From: <bugzilla@jessica.w3.org>
- Date: Thu, 09 Apr 2015 21:38:06 +0000
- To: www-dom@w3.org
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: annevk@annevk.nl Reporter: quanxunzhen@gmail.com QA Contact: public-webapps-bugzilla@w3.org CC: mike@w3.org, www-dom@w3.org 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.
Received on Thursday, 9 April 2015 21:38:07 UTC