@rescript/webapi 0.1.0-pre-alpha-b330deb → 0.1.0-pre-alpha-58ebc59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/CanvasAPI/CanvasPattern.res +2 -1
- package/src/CanvasAPI/OffscreenCanvas.res +1 -2
- package/src/CanvasAPI/Path2D.res +2 -1
- package/src/DOMAPI/HTMLFormElement.res +2 -0
- package/src/FetchAPI/BodyInit.res +5 -5
- package/src/FetchAPI/FormData.res +6 -7
- package/src/FetchAPI/FormDataEntryValue.res +2 -2
- package/src/FetchAPI/Request.res +4 -4
- package/src/FetchAPI/Response.res +9 -9
- package/src/PushAPI/PushEvent.res +3 -1
- package/src/PushAPI/PushMessageData.res +4 -2
- package/src/ServiceWorkerAPI/ServiceWorker.res +6 -5
- package/src/WebSocketsAPI/MessageEvent.res +2 -2
- package/src/WebSocketsAPI/WebSocket.res +1 -1
- package/src/WebWorkersAPI/SharedWorker.res +13 -11
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
module Types = CanvasTypes
|
|
2
2
|
|
|
3
3
|
type t = Types.canvasPattern = {...Types.canvasPattern}
|
|
4
|
+
type domMatrix2DInit = DOMTypes.domMatrix2DInit = {...DOMTypes.domMatrix2DInit}
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation.
|
|
7
8
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/CanvasPattern/setTransform)
|
|
8
9
|
*/
|
|
9
10
|
@send
|
|
10
|
-
external setTransform: (t, ~transform:
|
|
11
|
+
external setTransform: (t, ~transform: domMatrix2DInit=?) => unit = "setTransform"
|
|
11
12
|
|
|
12
13
|
let isInstanceOf = (_: 't): bool => %raw(`param instanceof CanvasPattern`)
|
|
@@ -95,5 +95,4 @@ The argument, if provided, is a dictionary that controls the encoding options of
|
|
|
95
95
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/convertToBlob)
|
|
96
96
|
*/
|
|
97
97
|
@send
|
|
98
|
-
external convertToBlob: (t, ~options: imageEncodeOptions=?) => promise<
|
|
99
|
-
"convertToBlob"
|
|
98
|
+
external convertToBlob: (t, ~options: imageEncodeOptions=?) => promise<Blob.t> = "convertToBlob"
|
package/src/CanvasAPI/Path2D.res
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module Types = CanvasTypes
|
|
2
2
|
|
|
3
3
|
type t = Types.path2D = {...Types.path2D}
|
|
4
|
+
type domMatrix2DInit = DOMTypes.domMatrix2DInit = {...DOMTypes.domMatrix2DInit}
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Path2D)
|
|
@@ -114,4 +115,4 @@ Adds to the path the path given by the argument.
|
|
|
114
115
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Path2D/addPath)
|
|
115
116
|
*/
|
|
116
117
|
@send
|
|
117
|
-
external addPath: (t, ~path: t, ~transform:
|
|
118
|
+
external addPath: (t, ~path: t, ~transform: domMatrix2DInit=?) => unit = "addPath"
|
|
@@ -25,24 +25,24 @@ external fromDataView: DataView.t => t = "%identity"
|
|
|
25
25
|
/**
|
|
26
26
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_a_body)
|
|
27
27
|
*/
|
|
28
|
-
external fromBlob:
|
|
28
|
+
external fromBlob: Blob.t => t = "%identity"
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_a_body)
|
|
32
32
|
*/
|
|
33
|
-
external fromFile:
|
|
33
|
+
external fromFile: File.t => t = "%identity"
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_a_body)
|
|
37
37
|
*/
|
|
38
|
-
external fromURLSearchParams:
|
|
38
|
+
external fromURLSearchParams: URLSearchParams.t => t = "%identity"
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
41
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_a_body)
|
|
42
42
|
*/
|
|
43
|
-
external fromFormData:
|
|
43
|
+
external fromFormData: FormData.t => t = "%identity"
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#setting_a_body)
|
|
47
47
|
*/
|
|
48
|
-
external fromReadableStream:
|
|
48
|
+
external fromReadableStream: ReadableStream.t<'t> => t = "%identity"
|
|
@@ -5,10 +5,11 @@ module Types = FetchTypes
|
|
|
5
5
|
*/
|
|
6
6
|
@new
|
|
7
7
|
type t = Types.formData = {...Types.formData}
|
|
8
|
-
type formDataEntryValue =
|
|
8
|
+
type formDataEntryValue = FormDataEntryValue.t
|
|
9
|
+
type htmlFormElement = HTMLFormElement.t
|
|
10
|
+
type htmlElement = HTMLElement.t
|
|
9
11
|
|
|
10
|
-
external make: (~form:
|
|
11
|
-
"FormData"
|
|
12
|
+
external make: (~form: htmlFormElement=?, ~submitter: htmlElement=?) => t = "FormData"
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/append)
|
|
@@ -20,8 +21,7 @@ external append: (t, ~name: string, ~value: string) => unit = "append"
|
|
|
20
21
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/append)
|
|
21
22
|
*/
|
|
22
23
|
@send
|
|
23
|
-
external appendBlob: (t, ~name: string, ~blobValue:
|
|
24
|
-
"append"
|
|
24
|
+
external appendBlob: (t, ~name: string, ~blobValue: Blob.t, ~filename: string=?) => unit = "append"
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/delete)
|
|
@@ -69,5 +69,4 @@ external set: (t, ~name: string, ~value: string) => unit = "set"
|
|
|
69
69
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FormData/set)
|
|
70
70
|
*/
|
|
71
71
|
@send
|
|
72
|
-
external setBlob: (t, ~name: string, ~blobValue:
|
|
73
|
-
"set"
|
|
72
|
+
external setBlob: (t, ~name: string, ~blobValue: Blob.t, ~filename: string=?) => unit = "set"
|
|
@@ -5,7 +5,7 @@ module Types = FetchTypes
|
|
|
5
5
|
type t = Types.formDataEntryValue
|
|
6
6
|
|
|
7
7
|
external fromString: string => t = "%identity"
|
|
8
|
-
external fromFile:
|
|
8
|
+
external fromFile: File.t => t = "%identity"
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
Represents a decoded version of the abstract `formDataEntryValue` type.
|
|
@@ -13,7 +13,7 @@ A FormData entry value is either a string or a File.
|
|
|
13
13
|
*/
|
|
14
14
|
type decoded =
|
|
15
15
|
| String(string)
|
|
16
|
-
| File(
|
|
16
|
+
| File(File.t)
|
|
17
17
|
|
|
18
18
|
let decode = (value: t): decoded => {
|
|
19
19
|
if File.isInstanceOf(value) {
|
package/src/FetchAPI/Request.res
CHANGED
|
@@ -2,8 +2,8 @@ module Types = FetchTypes
|
|
|
2
2
|
|
|
3
3
|
type t = Types.request = {...Types.request}
|
|
4
4
|
type requestInit = Types.requestInit = {...Types.requestInit}
|
|
5
|
-
type bodyInit =
|
|
6
|
-
type headersInit =
|
|
5
|
+
type bodyInit = BodyInit.t
|
|
6
|
+
type headersInit = HeadersInit.t
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request)
|
|
@@ -27,7 +27,7 @@ external arrayBuffer: t => promise<ArrayBuffer.t> = "arrayBuffer"
|
|
|
27
27
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/blob)
|
|
28
28
|
*/
|
|
29
29
|
@send
|
|
30
|
-
external blob: t => promise<
|
|
30
|
+
external blob: t => promise<Blob.t> = "blob"
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
@@ -39,7 +39,7 @@ external bytes: t => promise<array<int>> = "bytes"
|
|
|
39
39
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/formData)
|
|
40
40
|
*/
|
|
41
41
|
@send
|
|
42
|
-
external formData: t => promise<
|
|
42
|
+
external formData: t => promise<FormData.t> = "formData"
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/json)
|
|
@@ -2,8 +2,8 @@ module Types = FetchTypes
|
|
|
2
2
|
|
|
3
3
|
type t = Types.response = {...Types.response}
|
|
4
4
|
type responseInit = Types.responseInit = {...Types.responseInit}
|
|
5
|
-
type bodyInit =
|
|
6
|
-
type headersInit =
|
|
5
|
+
type bodyInit = BodyInit.t
|
|
6
|
+
type headersInit = HeadersInit.t
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
@@ -39,31 +39,31 @@ external fromDataView: (DataView.t, ~init: responseInit=?) => t = "Response"
|
|
|
39
39
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
40
40
|
*/
|
|
41
41
|
@new
|
|
42
|
-
external fromBlob: (
|
|
42
|
+
external fromBlob: (Blob.t, ~init: responseInit=?) => t = "Response"
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
46
46
|
*/
|
|
47
47
|
@new
|
|
48
|
-
external fromFile: (
|
|
48
|
+
external fromFile: (File.t, ~init: responseInit=?) => t = "Response"
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
52
52
|
*/
|
|
53
53
|
@new
|
|
54
|
-
external fromURLSearchParams: (
|
|
54
|
+
external fromURLSearchParams: (URLSearchParams.t, ~init: responseInit=?) => t = "Response"
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
58
58
|
*/
|
|
59
59
|
@new
|
|
60
|
-
external fromFormData: (
|
|
60
|
+
external fromFormData: (FormData.t, ~init: responseInit=?) => t = "Response"
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
63
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Response)
|
|
64
64
|
*/
|
|
65
65
|
@new
|
|
66
|
-
external fromReadableStream: (
|
|
66
|
+
external fromReadableStream: (ReadableStream.t<'t>, ~init: responseInit=?) => t = "Response"
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer)
|
|
@@ -75,7 +75,7 @@ external arrayBuffer: t => promise<ArrayBuffer.t> = "arrayBuffer"
|
|
|
75
75
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/blob)
|
|
76
76
|
*/
|
|
77
77
|
@send
|
|
78
|
-
external blob: t => promise<
|
|
78
|
+
external blob: t => promise<Blob.t> = "blob"
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/bytes)
|
|
@@ -87,7 +87,7 @@ external bytes: t => promise<array<int>> = "bytes"
|
|
|
87
87
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/formData)
|
|
88
88
|
*/
|
|
89
89
|
@send
|
|
90
|
-
external formData: t => promise<
|
|
90
|
+
external formData: t => promise<FormData.t> = "formData"
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Request/json)
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
open PushTypes
|
|
2
2
|
|
|
3
|
+
type t = pushMessageData
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
The json() method of the PushMessageData interface extracts push message data by parsing it as a JSON string and returning the result.
|
|
5
7
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushMessageData/json)
|
|
6
8
|
*/
|
|
7
9
|
@send
|
|
8
|
-
external json:
|
|
10
|
+
external json: t => JSON.t = "json"
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
The text() method of the PushMessageData interface extracts push message data as a plain text string.
|
|
12
14
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/PushMessageData/text)
|
|
13
15
|
*/
|
|
14
16
|
@send
|
|
15
|
-
external text:
|
|
17
|
+
external text: t => string = "text"
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
open ServiceWorkerTypes
|
|
2
|
-
open ChannelMessagingTypes
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
type t = serviceWorker = {...serviceWorker}
|
|
4
|
+
|
|
5
|
+
include EventTarget.Impl({type t = t})
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/postMessage)
|
|
8
9
|
*/
|
|
9
10
|
@send
|
|
10
|
-
external postMessage: (
|
|
11
|
+
external postMessage: (t, ~message: JSON.t, ~transfer: array<Dict.t<string>>) => unit =
|
|
11
12
|
"postMessage"
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -15,7 +16,7 @@ external postMessage: (serviceWorker, ~message: JSON.t, ~transfer: array<Dict.t<
|
|
|
15
16
|
*/
|
|
16
17
|
@send
|
|
17
18
|
external postMessageWithOptions: (
|
|
18
|
-
|
|
19
|
+
t,
|
|
19
20
|
~message: JSON.t,
|
|
20
|
-
~options: structuredSerializeOptions=?,
|
|
21
|
+
~options: MessagePort.structuredSerializeOptions=?,
|
|
21
22
|
) => unit = "postMessage"
|
|
@@ -9,13 +9,13 @@ type messageEventInit<'t> = Types.messageEventInit<'t> = {...Types.messageEventI
|
|
|
9
9
|
@new
|
|
10
10
|
external make: (~type_: string, ~eventInitDict: messageEventInit<'t>=?) => t<'t> = "MessageEvent"
|
|
11
11
|
|
|
12
|
-
external asEvent: t<'t> =>
|
|
12
|
+
external asEvent: t<'t> => Event.t = "%identity"
|
|
13
13
|
/**
|
|
14
14
|
Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget.
|
|
15
15
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
|
|
16
16
|
*/
|
|
17
17
|
@send
|
|
18
|
-
external composedPath: t<'t> => array<
|
|
18
|
+
external composedPath: t<'t> => array<EventTarget.t> = "composedPath"
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
|
|
@@ -46,7 +46,7 @@ Transmits data using the WebSocket connection. data can be a string, a Blob, an
|
|
|
46
46
|
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
|
|
47
47
|
*/
|
|
48
48
|
@send
|
|
49
|
-
external sendBlob: (t,
|
|
49
|
+
external sendBlob: (t, Blob.t) => unit = "send"
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
open ChannelMessagingTypes
|
|
2
1
|
open WebWorkersTypes
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
type t = sharedWorker
|
|
4
|
+
type workerType = WebWorkersTypes.workerType
|
|
5
|
+
type workerOptions = WebWorkersTypes.workerOptions = {...WebWorkersTypes.workerOptions}
|
|
6
|
+
|
|
7
|
+
include EventTarget.Impl({type t = t})
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
`make(string)`
|
|
@@ -10,13 +13,13 @@ The SharedWorker() constructor creates a SharedWorker object that executes the
|
|
|
10
13
|
script at the specified URL. This script must obey the same-origin policy.
|
|
11
14
|
|
|
12
15
|
```res
|
|
13
|
-
let shared:
|
|
16
|
+
let shared: SharedWorker.t = SharedWorker.make("sharedworker.js")
|
|
14
17
|
```
|
|
15
18
|
|
|
16
19
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/)
|
|
17
20
|
*/
|
|
18
21
|
@new
|
|
19
|
-
external make: string =>
|
|
22
|
+
external make: string => t = "SharedWorker"
|
|
20
23
|
|
|
21
24
|
/**
|
|
22
25
|
`makeWithName(string, string)`
|
|
@@ -25,13 +28,13 @@ The SharedWorker() constructor creates a SharedWorker object that executes the
|
|
|
25
28
|
script at the specified URL. This script must obey the same-origin policy.
|
|
26
29
|
|
|
27
30
|
```res
|
|
28
|
-
let shared:
|
|
31
|
+
let shared: SharedWorker.t = SharedWorker.makeWithName("sharedworker.js", "name")
|
|
29
32
|
```
|
|
30
33
|
|
|
31
34
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/)
|
|
32
35
|
*/
|
|
33
36
|
@new
|
|
34
|
-
external makeWithName: (string, string) =>
|
|
37
|
+
external makeWithName: (string, string) => t = "SharedWorker"
|
|
35
38
|
|
|
36
39
|
/**
|
|
37
40
|
`makeWithOptions(string, workerOptions)`
|
|
@@ -40,16 +43,15 @@ The SharedWorker() constructor creates a SharedWorker object that executes the
|
|
|
40
43
|
script at the specified URL. This script must obey the same-origin policy.
|
|
41
44
|
|
|
42
45
|
```res
|
|
43
|
-
let shared:
|
|
46
|
+
let shared: SharedWorker.t = SharedWorker.makeWithOptions("sharedworker.js", {
|
|
44
47
|
name: "workerName",
|
|
45
|
-
type_: Module
|
|
46
48
|
})
|
|
47
49
|
```
|
|
48
50
|
|
|
49
51
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/)
|
|
50
52
|
*/
|
|
51
53
|
@new
|
|
52
|
-
external makeWithOptions: (string, workerOptions) =>
|
|
54
|
+
external makeWithOptions: (string, workerOptions) => t = "SharedWorker"
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
`port(sharedWorker)`
|
|
@@ -58,10 +60,10 @@ The port property of the SharedWorker interface returns a MessagePort object
|
|
|
58
60
|
used to communicate and control the shared worker.
|
|
59
61
|
|
|
60
62
|
```res
|
|
61
|
-
let port:
|
|
63
|
+
let port: MessagePort.t = SharedWorker.port(myWorker)
|
|
62
64
|
```
|
|
63
65
|
|
|
64
66
|
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/port)
|
|
65
67
|
*/
|
|
66
68
|
@get
|
|
67
|
-
external port:
|
|
69
|
+
external port: t => MessagePort.t = "port"
|