Skip to content

Commit dd527dc

Browse files
committed
Remove hardcoded emitAddOrRemoveEventListener
1 parent a1bea7d commit dd527dc

File tree

125 files changed

+2257
-5742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+2257
-5742
lines changed

src/CSSFontLoadingAPI/FontFaceSet.res

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,11 @@ The event listener is appended to target's event listener list and is not append
1919
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
2020
*/
2121
@send
22-
external addEventListener: (fontFaceSet, eventType, eventListener<'event>) => unit =
23-
"addEventListener"
24-
25-
/**
26-
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
27-
28-
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
29-
30-
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
31-
32-
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
33-
34-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
35-
36-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
37-
38-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
39-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
40-
*/
41-
@send
42-
external addEventListenerWithOptions: (
22+
external addEventListener: (
4323
fontFaceSet,
44-
eventType,
45-
eventListener<'event>,
46-
addEventListenerOptions,
24+
~type_: eventType,
25+
~callback: eventListener<'event>,
26+
~options: addEventListenerOptions=?,
4727
) => unit = "addEventListener"
4828

4929
/**
@@ -63,44 +43,36 @@ The event listener is appended to target's event listener list and is not append
6343
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
6444
*/
6545
@send
66-
external addEventListenerWithUseCapture: (
46+
external addEventListener2: (
6747
fontFaceSet,
68-
eventType,
69-
eventListener<'event>,
70-
bool,
48+
~type_: eventType,
49+
~callback: eventListener<'event>,
50+
~options: bool=?,
7151
) => unit = "addEventListener"
7252

7353
/**
7454
Removes the event listener in target's event listener list with the same type, callback, and options.
7555
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
7656
*/
7757
@send
78-
external removeEventListener: (fontFaceSet, eventType, eventListener<'event>) => unit =
79-
"addEventListener"
80-
81-
/**
82-
Removes the event listener in target's event listener list with the same type, callback, and options.
83-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
84-
*/
85-
@send
86-
external removeEventListenerWithOptions: (
58+
external removeEventListener: (
8759
fontFaceSet,
88-
eventType,
89-
eventListener<'event>,
90-
eventListenerOptions,
91-
) => unit = "addEventListener"
60+
~type_: eventType,
61+
~callback: eventListener<'event>,
62+
~options: eventListenerOptions=?,
63+
) => unit = "removeEventListener"
9264

9365
/**
9466
Removes the event listener in target's event listener list with the same type, callback, and options.
9567
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
9668
*/
9769
@send
98-
external removeEventListenerWithUseCapture: (
70+
external removeEventListener2: (
9971
fontFaceSet,
100-
eventType,
101-
eventListener<'event>,
102-
bool,
103-
) => unit = "addEventListener"
72+
~type_: eventType,
73+
~callback: eventListener<'event>,
74+
~options: bool=?,
75+
) => unit = "removeEventListener"
10476

10577
/**
10678
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

src/CanvasAPI/OffscreenCanvas.res

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,11 @@ The event listener is appended to target's event listener list and is not append
2828
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
2929
*/
3030
@send
31-
external addEventListener: (offscreenCanvas, eventType, eventListener<'event>) => unit =
32-
"addEventListener"
33-
34-
/**
35-
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
36-
37-
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
38-
39-
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
40-
41-
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
42-
43-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
44-
45-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
46-
47-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
48-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
49-
*/
50-
@send
51-
external addEventListenerWithOptions: (
31+
external addEventListener: (
5232
offscreenCanvas,
53-
eventType,
54-
eventListener<'event>,
55-
addEventListenerOptions,
33+
~type_: eventType,
34+
~callback: eventListener<'event>,
35+
~options: addEventListenerOptions=?,
5636
) => unit = "addEventListener"
5737

5838
/**
@@ -72,44 +52,36 @@ The event listener is appended to target's event listener list and is not append
7252
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
7353
*/
7454
@send
75-
external addEventListenerWithUseCapture: (
55+
external addEventListener2: (
7656
offscreenCanvas,
77-
eventType,
78-
eventListener<'event>,
79-
bool,
57+
~type_: eventType,
58+
~callback: eventListener<'event>,
59+
~options: bool=?,
8060
) => unit = "addEventListener"
8161

8262
/**
8363
Removes the event listener in target's event listener list with the same type, callback, and options.
8464
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
8565
*/
8666
@send
87-
external removeEventListener: (offscreenCanvas, eventType, eventListener<'event>) => unit =
88-
"addEventListener"
89-
90-
/**
91-
Removes the event listener in target's event listener list with the same type, callback, and options.
92-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
93-
*/
94-
@send
95-
external removeEventListenerWithOptions: (
67+
external removeEventListener: (
9668
offscreenCanvas,
97-
eventType,
98-
eventListener<'event>,
99-
eventListenerOptions,
100-
) => unit = "addEventListener"
69+
~type_: eventType,
70+
~callback: eventListener<'event>,
71+
~options: eventListenerOptions=?,
72+
) => unit = "removeEventListener"
10173

10274
/**
10375
Removes the event listener in target's event listener list with the same type, callback, and options.
10476
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
10577
*/
10678
@send
107-
external removeEventListenerWithUseCapture: (
79+
external removeEventListener2: (
10880
offscreenCanvas,
109-
eventType,
110-
eventListener<'event>,
111-
bool,
112-
) => unit = "addEventListener"
81+
~type_: eventType,
82+
~callback: eventListener<'event>,
83+
~options: bool=?,
84+
) => unit = "removeEventListener"
11385

11486
/**
11587
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

src/ChannelMessagingAPI/MessagePort.res

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,11 @@ The event listener is appended to target's event listener list and is not append
2020
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
2121
*/
2222
@send
23-
external addEventListener: (messagePort, eventType, eventListener<'event>) => unit =
24-
"addEventListener"
25-
26-
/**
27-
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
28-
29-
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
30-
31-
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
32-
33-
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
34-
35-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
36-
37-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
38-
39-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
40-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
41-
*/
42-
@send
43-
external addEventListenerWithOptions: (
23+
external addEventListener: (
4424
messagePort,
45-
eventType,
46-
eventListener<'event>,
47-
addEventListenerOptions,
25+
~type_: eventType,
26+
~callback: eventListener<'event>,
27+
~options: addEventListenerOptions=?,
4828
) => unit = "addEventListener"
4929

5030
/**
@@ -64,44 +44,36 @@ The event listener is appended to target's event listener list and is not append
6444
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
6545
*/
6646
@send
67-
external addEventListenerWithUseCapture: (
47+
external addEventListener2: (
6848
messagePort,
69-
eventType,
70-
eventListener<'event>,
71-
bool,
49+
~type_: eventType,
50+
~callback: eventListener<'event>,
51+
~options: bool=?,
7252
) => unit = "addEventListener"
7353

7454
/**
7555
Removes the event listener in target's event listener list with the same type, callback, and options.
7656
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
7757
*/
7858
@send
79-
external removeEventListener: (messagePort, eventType, eventListener<'event>) => unit =
80-
"addEventListener"
81-
82-
/**
83-
Removes the event listener in target's event listener list with the same type, callback, and options.
84-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
85-
*/
86-
@send
87-
external removeEventListenerWithOptions: (
59+
external removeEventListener: (
8860
messagePort,
89-
eventType,
90-
eventListener<'event>,
91-
eventListenerOptions,
92-
) => unit = "addEventListener"
61+
~type_: eventType,
62+
~callback: eventListener<'event>,
63+
~options: eventListenerOptions=?,
64+
) => unit = "removeEventListener"
9365

9466
/**
9567
Removes the event listener in target's event listener list with the same type, callback, and options.
9668
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
9769
*/
9870
@send
99-
external removeEventListenerWithUseCapture: (
71+
external removeEventListener2: (
10072
messagePort,
101-
eventType,
102-
eventListener<'event>,
103-
bool,
104-
) => unit = "addEventListener"
73+
~type_: eventType,
74+
~callback: eventListener<'event>,
75+
~options: bool=?,
76+
) => unit = "removeEventListener"
10577

10678
/**
10779
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

src/ClipboardAPI/Clipboard.res

Lines changed: 18 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,11 @@ The event listener is appended to target's event listener list and is not append
1919
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
2020
*/
2121
@send
22-
external addEventListener: (clipboard, eventType, eventListener<'event>) => unit =
23-
"addEventListener"
24-
25-
/**
26-
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
27-
28-
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
29-
30-
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
31-
32-
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
33-
34-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
35-
36-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
37-
38-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
39-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
40-
*/
41-
@send
42-
external addEventListenerWithOptions: (
22+
external addEventListener: (
4323
clipboard,
44-
eventType,
45-
eventListener<'event>,
46-
addEventListenerOptions,
24+
~type_: eventType,
25+
~callback: eventListener<'event>,
26+
~options: addEventListenerOptions=?,
4727
) => unit = "addEventListener"
4828

4929
/**
@@ -63,44 +43,36 @@ The event listener is appended to target's event listener list and is not append
6343
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
6444
*/
6545
@send
66-
external addEventListenerWithUseCapture: (
46+
external addEventListener2: (
6747
clipboard,
68-
eventType,
69-
eventListener<'event>,
70-
bool,
48+
~type_: eventType,
49+
~callback: eventListener<'event>,
50+
~options: bool=?,
7151
) => unit = "addEventListener"
7252

7353
/**
7454
Removes the event listener in target's event listener list with the same type, callback, and options.
7555
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
7656
*/
7757
@send
78-
external removeEventListener: (clipboard, eventType, eventListener<'event>) => unit =
79-
"addEventListener"
80-
81-
/**
82-
Removes the event listener in target's event listener list with the same type, callback, and options.
83-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
84-
*/
85-
@send
86-
external removeEventListenerWithOptions: (
58+
external removeEventListener: (
8759
clipboard,
88-
eventType,
89-
eventListener<'event>,
90-
eventListenerOptions,
91-
) => unit = "addEventListener"
60+
~type_: eventType,
61+
~callback: eventListener<'event>,
62+
~options: eventListenerOptions=?,
63+
) => unit = "removeEventListener"
9264

9365
/**
9466
Removes the event listener in target's event listener list with the same type, callback, and options.
9567
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
9668
*/
9769
@send
98-
external removeEventListenerWithUseCapture: (
70+
external removeEventListener2: (
9971
clipboard,
100-
eventType,
101-
eventListener<'event>,
102-
bool,
103-
) => unit = "addEventListener"
72+
~type_: eventType,
73+
~callback: eventListener<'event>,
74+
~options: bool=?,
75+
) => unit = "removeEventListener"
10476

10577
/**
10678
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

0 commit comments

Comments
 (0)