Skip to content

Commit 5ee8bff

Browse files
committed
Add method overloads
1 parent 68d4ecd commit 5ee8bff

File tree

103 files changed

+2316
-91
lines changed

Some content is hidden

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

103 files changed

+2316
-91
lines changed

src/CanvasAPI.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ type offscreenRenderingContext = any
5151

5252
type imageEncodeOptions = {
5353
@as("type") mutable type_?: string,
54-
mutable quality?: any,
54+
mutable quality?: float,
5555
}

src/ChannelMessagingAPI.res

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ This Channel Messaging API interface represents one of the two ports of a Messag
99
type messagePort = {
1010
...eventTarget,
1111
}
12+
13+
type structuredSerializeOptions = {mutable transfer?: array<Dict.t<string>>}

src/ChannelMessagingAPI/MessagePort.res

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ Throws a "DataCloneError" DOMException if transfer contains duplicate objects or
118118
@send
119119
external postMessage: (messagePort, any, array<Dict.t<string>>) => unit = "postMessage"
120120

121+
/**
122+
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.
123+
124+
Throws a "DataCloneError" DOMException if transfer contains duplicate objects or port, or if message could not be cloned.
125+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessagePort/postMessage)
126+
*/
127+
@send
128+
external postMessage2: (messagePort, any, structuredSerializeOptions) => unit = "postMessage"
129+
121130
/**
122131
Begins dispatching messages received on the port.
123132
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessagePort/start)

src/DOMAPI.res

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ open IndexedDBAPI
3030
open WebCryptoAPI
3131
open PerformanceAPI
3232
open WebStorageAPI
33+
open ChannelMessagingAPI
3334

3435
type shadowRootMode =
3536
| @as("closed") Closed
@@ -143,6 +144,12 @@ type scrollLogicalPosition =
143144
| @as("nearest") Nearest
144145
| @as("start") Start
145146

147+
type selectionMode =
148+
| @as("end") End
149+
| @as("preserve") Preserve
150+
| @as("select") Select
151+
| @as("start") Start
152+
146153
type shareData = {
147154
mutable files?: array<file>,
148155
mutable title?: string,
@@ -2558,11 +2565,11 @@ and element = {
25582565
/**
25592566
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
25602567
*/
2561-
mutable scrollTop: any,
2568+
mutable scrollTop: float,
25622569
/**
25632570
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
25642571
*/
2565-
mutable scrollLeft: any,
2572+
mutable scrollLeft: float,
25662573
/**
25672574
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
25682575
*/
@@ -3035,11 +3042,11 @@ and htmlElement = {
30353042
/**
30363043
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
30373044
*/
3038-
mutable scrollTop: any,
3045+
mutable scrollTop: float,
30393046
/**
30403047
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
30413048
*/
3042-
mutable scrollLeft: any,
3049+
mutable scrollLeft: float,
30433050
/**
30443051
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
30453052
*/
@@ -3408,11 +3415,11 @@ and htmlHeadElement = {
34083415
/**
34093416
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
34103417
*/
3411-
mutable scrollTop: any,
3418+
mutable scrollTop: float,
34123419
/**
34133420
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
34143421
*/
3415-
mutable scrollLeft: any,
3422+
mutable scrollLeft: float,
34163423
/**
34173424
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
34183425
*/
@@ -3664,11 +3671,11 @@ and htmlFormElement = {
36643671
/**
36653672
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
36663673
*/
3667-
mutable scrollTop: any,
3674+
mutable scrollTop: float,
36683675
/**
36693676
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
36703677
*/
3671-
mutable scrollLeft: any,
3678+
mutable scrollLeft: float,
36723679
/**
36733680
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
36743681
*/
@@ -3971,11 +3978,11 @@ and htmlImageElement = {
39713978
/**
39723979
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
39733980
*/
3974-
mutable scrollTop: any,
3981+
mutable scrollTop: float,
39753982
/**
39763983
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
39773984
*/
3978-
mutable scrollLeft: any,
3985+
mutable scrollLeft: float,
39793986
/**
39803987
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
39813988
*/
@@ -4314,11 +4321,11 @@ and htmlEmbedElement = {
43144321
/**
43154322
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
43164323
*/
4317-
mutable scrollTop: any,
4324+
mutable scrollTop: float,
43184325
/**
43194326
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
43204327
*/
4321-
mutable scrollLeft: any,
4328+
mutable scrollLeft: float,
43224329
/**
43234330
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
43244331
*/
@@ -4586,11 +4593,11 @@ and htmlAnchorElement = {
45864593
/**
45874594
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
45884595
*/
4589-
mutable scrollTop: any,
4596+
mutable scrollTop: float,
45904597
/**
45914598
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
45924599
*/
4593-
mutable scrollLeft: any,
4600+
mutable scrollLeft: float,
45944601
/**
45954602
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
45964603
*/
@@ -4959,11 +4966,11 @@ and htmlAreaElement = {
49594966
/**
49604967
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
49614968
*/
4962-
mutable scrollTop: any,
4969+
mutable scrollTop: float,
49634970
/**
49644971
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
49654972
*/
4966-
mutable scrollLeft: any,
4973+
mutable scrollLeft: float,
49674974
/**
49684975
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
49694976
*/
@@ -5312,11 +5319,11 @@ and htmlScriptElement = {
53125319
/**
53135320
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
53145321
*/
5315-
mutable scrollTop: any,
5322+
mutable scrollTop: float,
53165323
/**
53175324
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
53185325
*/
5319-
mutable scrollLeft: any,
5326+
mutable scrollLeft: float,
53205327
/**
53215328
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
53225329
*/
@@ -6550,11 +6557,11 @@ and htmlSlotElement = {
65506557
/**
65516558
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTop)
65526559
*/
6553-
mutable scrollTop: any,
6560+
mutable scrollTop: float,
65546561
/**
65556562
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft)
65566563
*/
6557-
mutable scrollLeft: any,
6564+
mutable scrollLeft: float,
65586565
/**
65596566
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth)
65606567
*/
@@ -6677,35 +6684,35 @@ type domRectReadOnly = {
66776684
/**
66786685
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/x)
66796686
*/
6680-
x: any,
6687+
x: float,
66816688
/**
66826689
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/y)
66836690
*/
6684-
y: any,
6691+
y: float,
66856692
/**
66866693
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/width)
66876694
*/
6688-
width: any,
6695+
width: float,
66896696
/**
66906697
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/height)
66916698
*/
6692-
height: any,
6699+
height: float,
66936700
/**
66946701
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/top)
66956702
*/
6696-
top: any,
6703+
top: float,
66976704
/**
66986705
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/right)
66996706
*/
6700-
right: any,
6707+
right: float,
67016708
/**
67026709
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/bottom)
67036710
*/
6704-
bottom: any,
6711+
bottom: float,
67056712
/**
67066713
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/left)
67076714
*/
6708-
left: any,
6715+
left: float,
67096716
}
67106717

67116718
/**
@@ -7820,7 +7827,7 @@ and htmlInputElement = {
78207827
Returns the input field value as a number.
78217828
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/valueAsNumber)
78227829
*/
7823-
mutable valueAsNumber: any,
7830+
mutable valueAsNumber: float,
78247831
/**
78257832
Sets or retrieves the width of the object.
78267833
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/width)
@@ -8101,7 +8108,7 @@ type htmlMediaElement = {
81018108
Returns the duration in seconds of the current media resource. A NaN value is returned if duration is not available, or Infinity if the media resource is streaming.
81028109
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/duration)
81038110
*/
8104-
duration: any,
8111+
duration: float,
81058112
/**
81068113
Gets a flag that specifies whether playback is paused.
81078114
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/paused)
@@ -8961,7 +8968,7 @@ type xPathResult = {
89618968
/**
89628969
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/XPathResult/numberValue)
89638970
*/
8964-
numberValue: any,
8971+
numberValue: float,
89658972
/**
89668973
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/XPathResult/stringValue)
89678974
*/
@@ -9060,8 +9067,8 @@ type scrollOptions = {mutable behavior?: scrollBehavior}
90609067

90619068
type scrollToOptions = {
90629069
...scrollOptions,
9063-
mutable left?: any,
9064-
mutable top?: any,
9070+
mutable left?: float,
9071+
mutable top?: float,
90659072
}
90669073

90679074
type fullscreenOptions = {mutable navigationUI?: fullscreenNavigationUI}
@@ -9078,10 +9085,10 @@ type caretPositionFromPointOptions = {mutable shadowRoots?: array<shadowRoot>}
90789085
type idleRequestOptions = {mutable timeout?: int}
90799086

90809087
type domRectInit = {
9081-
mutable x?: any,
9082-
mutable y?: any,
9083-
mutable width?: any,
9084-
mutable height?: any,
9088+
mutable x?: float,
9089+
mutable y?: float,
9090+
mutable width?: float,
9091+
mutable height?: float,
90859092
}
90869093

90879094
type validityStateFlags = {
@@ -9123,7 +9130,7 @@ type focusOptions = {mutable preventScroll?: bool}
91239130
type effectTiming = {
91249131
mutable fill?: fillMode,
91259132
mutable iterationStart?: float,
9126-
mutable iterations?: any,
9133+
mutable iterations?: float,
91279134
mutable direction?: playbackDirection,
91289135
mutable easing?: string,
91299136
mutable delay?: float,
@@ -9137,7 +9144,7 @@ type getAnimationsOptions = {mutable subtree?: bool}
91379144
type computedEffectTiming = {
91389145
...effectTiming,
91399146
mutable progress?: Null.t<float>,
9140-
mutable currentIteration?: Null.t<any>,
9147+
mutable currentIteration?: Null.t<float>,
91419148
mutable startTime?: float,
91429149
mutable endTime?: float,
91439150
mutable activeDuration?: float,
@@ -9149,7 +9156,7 @@ type optionalEffectTiming = {
91499156
mutable endDelay?: float,
91509157
mutable fill?: fillMode,
91519158
mutable iterationStart?: float,
9152-
mutable iterations?: any,
9159+
mutable iterations?: float,
91539160
mutable duration?: unknown,
91549161
mutable direction?: playbackDirection,
91559162
mutable easing?: string,
@@ -9165,14 +9172,17 @@ type imageBitmapOptions = {
91659172
mutable resizeQuality?: resizeQuality,
91669173
}
91679174

9168-
type structuredSerializeOptions = {mutable transfer?: array<Dict.t<string>>}
9169-
91709175
type scrollIntoViewOptions = {
91719176
...scrollOptions,
91729177
mutable block?: scrollLogicalPosition,
91739178
mutable inline?: scrollLogicalPosition,
91749179
}
91759180

9181+
type windowPostMessageOptions = {
9182+
...structuredSerializeOptions,
9183+
mutable targetOrigin?: string,
9184+
}
9185+
91769186
type xPathNSResolver = any
91779187

91789188
type timerHandler = any

src/DOMAPI/DOMRect.res

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
open DOMAPI
2-
open Prelude
32

43
/**
54
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRect)
65
*/
76
@new
8-
external make: (any, any, any, any) => domRect = "DOMRect"
7+
external make: (float, float, float, float) => domRect = "DOMRect"
98
/**
109
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRect/fromRect_static)
1110
*/

src/DOMAPI/DOMRectReadOnly.res

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
open DOMAPI
2-
open Prelude
32

43
/**
54
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly)
65
*/
76
@new
8-
external make: (any, any, any, any) => domRectReadOnly = "DOMRectReadOnly"
7+
external make: (float, float, float, float) => domRectReadOnly = "DOMRectReadOnly"
98
/**
109
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/fromRect_static)
1110
*/

src/DOMAPI/Document.res

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@ Opens a new window and loads a document specified by a given URL. Also, opens a
509509
@send
510510
external open_: (document, string, string) => document = "open"
511511

512+
/**
513+
Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method.
514+
@param url Specifies a MIME type for the document.
515+
@param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element.
516+
@param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported.
517+
@param replace Specifies whether the existing entry for the document is replaced in the history list.
518+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/open)
519+
*/
520+
@send
521+
external open2: (document, string, string, string) => window = "open"
522+
512523
/**
513524
Closes an output stream and forces the sent data to display.
514525
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/close)

0 commit comments

Comments
 (0)