Skip to content

Commit b1af4ac

Browse files
committed
Extract EventTarget methods
1 parent a0d5168 commit b1af4ac

Some content is hidden

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

60 files changed

+323
-2374
lines changed

src/CSSFontLoadingAPI/FontFaceSet.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CSSFontLoadingAPI/FontFaceSet.res

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,9 @@
11
open EventAPI
22
open CSSFontLoadingAPI
33

4-
external asEventTarget: fontFaceSet => eventTarget = "%identity"
5-
/**
6-
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.
7-
8-
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.
9-
10-
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.
11-
12-
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.
13-
14-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
15-
16-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
17-
18-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
19-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
20-
*/
21-
@send
22-
external addEventListener: (
23-
fontFaceSet,
24-
~type_: eventType,
25-
~callback: eventListener<'event>,
26-
~options: addEventListenerOptions=?,
27-
) => unit = "addEventListener"
28-
29-
/**
30-
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.
31-
32-
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.
33-
34-
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.
35-
36-
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.
37-
38-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
39-
40-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
41-
42-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
43-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
44-
*/
45-
@send
46-
external addEventListener2: (
47-
fontFaceSet,
48-
~type_: eventType,
49-
~callback: eventListener<'event>,
50-
~options: bool=?,
51-
) => unit = "addEventListener"
52-
53-
/**
54-
Removes the event listener in target's event listener list with the same type, callback, and options.
55-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
56-
*/
57-
@send
58-
external removeEventListener: (
59-
fontFaceSet,
60-
~type_: eventType,
61-
~callback: eventListener<'event>,
62-
~options: eventListenerOptions=?,
63-
) => unit = "removeEventListener"
64-
65-
/**
66-
Removes the event listener in target's event listener list with the same type, callback, and options.
67-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
68-
*/
69-
@send
70-
external removeEventListener2: (
71-
fontFaceSet,
72-
~type_: eventType,
73-
~callback: eventListener<'event>,
74-
~options: bool=?,
75-
) => unit = "removeEventListener"
76-
77-
/**
78-
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.
79-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
80-
*/
81-
@send
82-
external dispatchEvent: (fontFaceSet, event) => bool = "dispatchEvent"
4+
include EventTarget.Impl({
5+
type t = fontFaceSet
6+
})
837

848
/**
859
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FontFaceSet/add)

src/CanvasAPI/OffscreenCanvas.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CanvasAPI/OffscreenCanvas.res

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -9,85 +9,9 @@ open FileAPI
99
@new
1010
external make: (~width: int, ~height: int) => offscreenCanvas = "OffscreenCanvas"
1111

12-
external asEventTarget: offscreenCanvas => eventTarget = "%identity"
13-
/**
14-
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.
15-
16-
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.
17-
18-
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.
19-
20-
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.
21-
22-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
23-
24-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
25-
26-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
27-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
28-
*/
29-
@send
30-
external addEventListener: (
31-
offscreenCanvas,
32-
~type_: eventType,
33-
~callback: eventListener<'event>,
34-
~options: addEventListenerOptions=?,
35-
) => unit = "addEventListener"
36-
37-
/**
38-
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.
39-
40-
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.
41-
42-
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.
43-
44-
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.
45-
46-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
47-
48-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
49-
50-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
51-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
52-
*/
53-
@send
54-
external addEventListener2: (
55-
offscreenCanvas,
56-
~type_: eventType,
57-
~callback: eventListener<'event>,
58-
~options: bool=?,
59-
) => unit = "addEventListener"
60-
61-
/**
62-
Removes the event listener in target's event listener list with the same type, callback, and options.
63-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
64-
*/
65-
@send
66-
external removeEventListener: (
67-
offscreenCanvas,
68-
~type_: eventType,
69-
~callback: eventListener<'event>,
70-
~options: eventListenerOptions=?,
71-
) => unit = "removeEventListener"
72-
73-
/**
74-
Removes the event listener in target's event listener list with the same type, callback, and options.
75-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
76-
*/
77-
@send
78-
external removeEventListener2: (
79-
offscreenCanvas,
80-
~type_: eventType,
81-
~callback: eventListener<'event>,
82-
~options: bool=?,
83-
) => unit = "removeEventListener"
84-
85-
/**
86-
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.
87-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
88-
*/
89-
@send
90-
external dispatchEvent: (offscreenCanvas, event) => bool = "dispatchEvent"
12+
include EventTarget.Impl({
13+
type t = offscreenCanvas
14+
})
9115

9216
/**
9317
Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API.

src/ChannelMessagingAPI/MessagePort.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ChannelMessagingAPI/MessagePort.res

Lines changed: 3 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,8 @@
1-
open EventAPI
21
open ChannelMessagingAPI
3-
open Prelude
42

5-
external asEventTarget: messagePort => eventTarget = "%identity"
6-
/**
7-
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.
8-
9-
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.
10-
11-
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.
12-
13-
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.
14-
15-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
16-
17-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
18-
19-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
20-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
21-
*/
22-
@send
23-
external addEventListener: (
24-
messagePort,
25-
~type_: eventType,
26-
~callback: eventListener<'event>,
27-
~options: addEventListenerOptions=?,
28-
) => unit = "addEventListener"
29-
30-
/**
31-
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.
32-
33-
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.
34-
35-
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.
36-
37-
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.
38-
39-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
40-
41-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
42-
43-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
44-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
45-
*/
46-
@send
47-
external addEventListener2: (
48-
messagePort,
49-
~type_: eventType,
50-
~callback: eventListener<'event>,
51-
~options: bool=?,
52-
) => unit = "addEventListener"
53-
54-
/**
55-
Removes the event listener in target's event listener list with the same type, callback, and options.
56-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
57-
*/
58-
@send
59-
external removeEventListener: (
60-
messagePort,
61-
~type_: eventType,
62-
~callback: eventListener<'event>,
63-
~options: eventListenerOptions=?,
64-
) => unit = "removeEventListener"
65-
66-
/**
67-
Removes the event listener in target's event listener list with the same type, callback, and options.
68-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
69-
*/
70-
@send
71-
external removeEventListener2: (
72-
messagePort,
73-
~type_: eventType,
74-
~callback: eventListener<'event>,
75-
~options: bool=?,
76-
) => unit = "removeEventListener"
77-
78-
/**
79-
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.
80-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
81-
*/
82-
@send
83-
external dispatchEvent: (messagePort, event) => bool = "dispatchEvent"
3+
include EventTarget.Impl({
4+
type t = messagePort
5+
})
846

857
/**
868
Posts a message through the channel. Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.

src/ClipboardAPI/Clipboard.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ClipboardAPI/Clipboard.res

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,9 @@
11
open EventAPI
22
open ClipboardAPI
33

4-
external asEventTarget: clipboard => eventTarget = "%identity"
5-
/**
6-
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.
7-
8-
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.
9-
10-
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.
11-
12-
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.
13-
14-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
15-
16-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
17-
18-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
19-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
20-
*/
21-
@send
22-
external addEventListener: (
23-
clipboard,
24-
~type_: eventType,
25-
~callback: eventListener<'event>,
26-
~options: addEventListenerOptions=?,
27-
) => unit = "addEventListener"
28-
29-
/**
30-
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.
31-
32-
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.
33-
34-
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.
35-
36-
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.
37-
38-
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
39-
40-
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
41-
42-
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
43-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
44-
*/
45-
@send
46-
external addEventListener2: (
47-
clipboard,
48-
~type_: eventType,
49-
~callback: eventListener<'event>,
50-
~options: bool=?,
51-
) => unit = "addEventListener"
52-
53-
/**
54-
Removes the event listener in target's event listener list with the same type, callback, and options.
55-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
56-
*/
57-
@send
58-
external removeEventListener: (
59-
clipboard,
60-
~type_: eventType,
61-
~callback: eventListener<'event>,
62-
~options: eventListenerOptions=?,
63-
) => unit = "removeEventListener"
64-
65-
/**
66-
Removes the event listener in target's event listener list with the same type, callback, and options.
67-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
68-
*/
69-
@send
70-
external removeEventListener2: (
71-
clipboard,
72-
~type_: eventType,
73-
~callback: eventListener<'event>,
74-
~options: bool=?,
75-
) => unit = "removeEventListener"
76-
77-
/**
78-
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.
79-
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent)
80-
*/
81-
@send
82-
external dispatchEvent: (clipboard, event) => bool = "dispatchEvent"
4+
include EventTarget.Impl({
5+
type t = clipboard
6+
})
837

848
/**
859
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clipboard/read)

0 commit comments

Comments
 (0)