Last active
December 15, 2015 09:29
-
-
Save annevk/5238964 to your computer and use it in GitHub Desktop.
on() / off() sketch.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using some experimental JS IDL syntax: | |
augment EventTarget { | |
EventTarget on(String type, EventListener callback, | |
{boolean ignoreBubbles?, | |
String? filter = null, | |
enum("capturing", "target", "bubbling") phase = "bubbling", | |
String? marker = null}); | |
EventTarget off(String type, EventListener callback); | |
EventTarget off({ String? type = null, String? marker = null }); | |
} | |
filter takes a selector. When filter is supplied ignoreBubbles defaults to true | |
which means the Event.bubbles property is ignored during event dispatch making | |
event delegation work better. | |
marker can be used for namespacing. E.g. to remove all event listeners at once | |
registered for the "button" component. | |
Everything else is as you expect it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lovely. Any update on when can we have this?