mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:47:35 +00:00
LibWeb: Add support for the options variant of {add,remove}EventListener
This also adds a variant of {add,remove}_event_listener called {add,remove}_event_listener_with_options. This is used internally to perform {add,remove}_event_listener with a default constructed options struct. It was done like this because default constructing the Variant with the options struct requires the struct defintions to be present, which requires us to include AbortSignal.h, which would cause a circular include as AbortSignal.h includes EventTarget.h.
This commit is contained in:
parent
0e6c7eea0f
commit
3479f1c4e8
6 changed files with 121 additions and 22 deletions
|
@ -1,9 +1,20 @@
|
|||
#import <DOM/AbortSignal.idl>
|
||||
|
||||
interface EventTarget {
|
||||
|
||||
// FIXME: Both of these should take in options
|
||||
undefined addEventListener(DOMString type, EventListener? callback, optional boolean useCapture = false);
|
||||
undefined removeEventListener(DOMString type, EventListener? callback, optional boolean useCapture = false);
|
||||
undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options = {});
|
||||
undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options = {});
|
||||
|
||||
[ImplementedAs=dispatch_event_binding] boolean dispatchEvent(Event event);
|
||||
|
||||
};
|
||||
|
||||
dictionary EventListenerOptions {
|
||||
boolean capture = false;
|
||||
};
|
||||
|
||||
dictionary AddEventListenerOptions : EventListenerOptions {
|
||||
boolean passive = false;
|
||||
boolean once = false;
|
||||
AbortSignal signal;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue