@rescript/webapi 0.1.0-pre-alpha-02fb350 → 0.1.0-pre-alpha-4542085

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.
Files changed (47) hide show
  1. package/package.json +1 -1
  2. package/src/CSSFontLoadingAPI/FontFace.res +10 -5
  3. package/src/CSSFontLoadingAPI/FontFaceSet.res +11 -7
  4. package/src/CanvasAPI/CanvasGradient.res +4 -2
  5. package/src/CanvasAPI/CanvasPattern.res +4 -3
  6. package/src/CanvasAPI/FillStyle.res +15 -10
  7. package/src/CanvasAPI/ImageBitmap.res +4 -2
  8. package/src/CanvasAPI/ImageBitmapRenderingContext.res +5 -3
  9. package/src/CanvasAPI/OffscreenCanvas.res +27 -15
  10. package/src/CanvasAPI/Path2D.res +16 -15
  11. package/src/ChannelMessagingAPI/MessagePort.res +11 -6
  12. package/src/ClipboardAPI/Clipboard.res +9 -5
  13. package/src/CredentialManagementAPI/CredentialsContainer.res +10 -8
  14. package/src/FetchAPI/BodyInit.res +12 -12
  15. package/src/FetchAPI/FormData.res +18 -15
  16. package/src/FetchAPI/FormDataEntryValue.res +11 -9
  17. package/src/FetchAPI/Headers.res +14 -12
  18. package/src/FetchAPI/HeadersInit.res +6 -4
  19. package/src/FetchAPI/Request.res +16 -12
  20. package/src/FetchAPI/Response.res +27 -24
  21. package/src/FileAPI/Blob.res +10 -5
  22. package/src/FileAPI/File.res +8 -7
  23. package/src/FileAPI/FileSystemDirectoryHandle.res +18 -13
  24. package/src/FileAPI/FileSystemFileHandle.res +15 -5
  25. package/src/FileAPI/FileSystemHandle.res +4 -2
  26. package/src/FileAPI/ReadableStream.res +20 -10
  27. package/src/FileAPI/WritableStream.res +11 -8
  28. package/src/FileAPI/WritableStreamDefaultController.res +4 -2
  29. package/src/Global.res +0 -10
  30. package/src/HistoryAPI/History.res +9 -6
  31. package/src/IndexedDBAPI/IDBFactory.res +8 -4
  32. package/src/PerformanceAPI/Performance.res +18 -17
  33. package/src/PermissionsAPI/Permissions.res +5 -1
  34. package/src/ScreenWakeLockAPI/WakeLock.res +5 -1
  35. package/src/ServiceWorkerAPI/ServiceWorkerContainer.res +10 -9
  36. package/src/ServiceWorkerAPI/ServiceWorkerGlobalScope.res +6 -2
  37. package/src/StorageAPI/StorageManager.res +8 -4
  38. package/src/URLAPI/URL.res +6 -4
  39. package/src/URLAPI/URLSearchParams.res +18 -16
  40. package/src/WebCryptoAPI/Crypto.res +6 -2
  41. package/src/WebLocksAPI/LockManager.res +7 -4
  42. package/src/WebSocketsAPI/CloseEvent.res +6 -3
  43. package/src/WebSocketsAPI/MessageEvent.res +10 -9
  44. package/src/WebSocketsAPI/WebSocket.res +15 -10
  45. package/src/WebStorageAPI/Storage.res +11 -5
  46. package/src/WebWorkersAPI/SharedWorkerGlobalScope.res +3 -1
  47. package/src/WebWorkersAPI/WorkerGlobalScope.res +5 -1
@@ -1,9 +1,12 @@
1
- open WebSocketsTypes
1
+ module Types = WebSocketsTypes
2
2
 
3
- include Event.Impl({type t = closeEvent})
3
+ type t = Types.closeEvent = {...Types.closeEvent}
4
+ type closeEventInit = Types.closeEventInit = {...Types.closeEventInit}
5
+
6
+ include Event.Impl({type t = t})
4
7
 
5
8
  /**
6
9
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/CloseEvent)
7
10
  */
8
11
  @new
9
- external make: (~type_: string, ~eventInitDict: closeEventInit=?) => closeEvent = "CloseEvent"
12
+ external make: (~type_: string, ~eventInitDict: closeEventInit=?) => t = "CloseEvent"
@@ -1,38 +1,39 @@
1
- open EventTypes
2
- open WebSocketsTypes
1
+ module Types = WebSocketsTypes
2
+
3
+ type t<'t> = Types.messageEvent<'t> = {...Types.messageEvent<'t>}
4
+ type messageEventInit<'t> = Types.messageEventInit<'t> = {...Types.messageEventInit<'t>}
3
5
 
4
6
  /**
5
7
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/MessageEvent)
6
8
  */
7
9
  @new
8
- external make: (~type_: string, ~eventInitDict: messageEventInit<'t>=?) => messageEvent<'t> =
9
- "MessageEvent"
10
+ external make: (~type_: string, ~eventInitDict: messageEventInit<'t>=?) => t<'t> = "MessageEvent"
10
11
 
11
- external asEvent: messageEvent<'t> => event = "%identity"
12
+ external asEvent: t<'t> => EventTypes.event = "%identity"
12
13
  /**
13
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.
14
15
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/composedPath)
15
16
  */
16
17
  @send
17
- external composedPath: messageEvent<'t> => array<eventTarget> = "composedPath"
18
+ external composedPath: t<'t> => array<EventTypes.eventTarget> = "composedPath"
18
19
 
19
20
  /**
20
21
  When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
21
22
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation)
22
23
  */
23
24
  @send
24
- external stopPropagation: messageEvent<'t> => unit = "stopPropagation"
25
+ external stopPropagation: t<'t> => unit = "stopPropagation"
25
26
 
26
27
  /**
27
28
  Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
28
29
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation)
29
30
  */
30
31
  @send
31
- external stopImmediatePropagation: messageEvent<'t> => unit = "stopImmediatePropagation"
32
+ external stopImmediatePropagation: t<'t> => unit = "stopImmediatePropagation"
32
33
 
33
34
  /**
34
35
  If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled.
35
36
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Event/preventDefault)
36
37
  */
37
38
  @send
38
- external preventDefault: messageEvent<'t> => unit = "preventDefault"
39
+ external preventDefault: t<'t> => unit = "preventDefault"
@@ -1,51 +1,56 @@
1
- open WebSocketsTypes
2
- open FileTypes
1
+ module Types = WebSocketsTypes
2
+
3
+ type t = Types.webSocket = {...Types.webSocket}
4
+ type binaryType = Types.binaryType
5
+ type messageEvent<'t> = Types.messageEvent<'t> = {...Types.messageEvent<'t>}
6
+ type closeEvent = Types.closeEvent = {...Types.closeEvent}
7
+ type messageEventSource = Types.messageEventSource
3
8
 
4
9
  /**
5
10
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket)
6
11
  */
7
12
  @new
8
- external make: (~url: string, ~protocols: string=?) => webSocket = "WebSocket"
13
+ external make: (~url: string, ~protocols: string=?) => t = "WebSocket"
9
14
 
10
15
  /**
11
16
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket)
12
17
  */
13
18
  @new
14
- external makeWithProtocols: (~url: string, ~protocols: array<string>=?) => webSocket = "WebSocket"
19
+ external makeWithProtocols: (~url: string, ~protocols: array<string>=?) => t = "WebSocket"
15
20
 
16
- include EventTarget.Impl({type t = webSocket})
21
+ include EventTarget.Impl({type t = t})
17
22
 
18
23
  /**
19
24
  Closes the WebSocket connection, optionally using code as the the WebSocket connection close code and reason as the the WebSocket connection close reason.
20
25
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/close)
21
26
  */
22
27
  @send
23
- external close: (webSocket, ~code: int=?, ~reason: string=?) => unit = "close"
28
+ external close: (t, ~code: int=?, ~reason: string=?) => unit = "close"
24
29
 
25
30
  /**
26
31
  Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
27
32
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
28
33
  */
29
34
  @send
30
- external send: (webSocket, DataView.t) => unit = "send"
35
+ external send: (t, DataView.t) => unit = "send"
31
36
 
32
37
  /**
33
38
  Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
34
39
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
35
40
  */
36
41
  @send
37
- external sendArrayBuffer: (webSocket, ArrayBuffer.t) => unit = "send"
42
+ external sendArrayBuffer: (t, ArrayBuffer.t) => unit = "send"
38
43
 
39
44
  /**
40
45
  Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
41
46
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
42
47
  */
43
48
  @send
44
- external sendBlob: (webSocket, blob) => unit = "send"
49
+ external sendBlob: (t, FileTypes.blob) => unit = "send"
45
50
 
46
51
  /**
47
52
  Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
48
53
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/WebSocket/send)
49
54
  */
50
55
  @send
51
- external sendString: (webSocket, string) => unit = "send"
56
+ external sendString: (t, string) => unit = "send"
@@ -1,18 +1,24 @@
1
1
  open WebStorageTypes
2
2
 
3
+ type t = WebStorageTypes.storage = {...WebStorageTypes.storage}
4
+
5
+ external local: t = "localStorage"
6
+
7
+ external session: t = "sessionStorage"
8
+
3
9
  /**
4
10
  Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
5
11
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/key)
6
12
  */
7
13
  @send
8
- external key: (storage, int) => Null.t<string> = "key"
14
+ external key: (t, int) => Null.t<string> = "key"
9
15
 
10
16
  /**
11
17
  Returns the current value associated with the given key, or null if the given key does not exist.
12
18
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/getItem)
13
19
  */
14
20
  @send
15
- external getItem: (storage, string) => Null.t<string> = "getItem"
21
+ external getItem: (t, string) => Null.t<string> = "getItem"
16
22
 
17
23
  /**
18
24
  Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
@@ -23,7 +29,7 @@ Dispatches a storage event on Window objects holding an equivalent Storage objec
23
29
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/setItem)
24
30
  */
25
31
  @send
26
- external setItem: (storage, ~key: string, ~value: string) => unit = "setItem"
32
+ external setItem: (t, ~key: string, ~value: string) => unit = "setItem"
27
33
 
28
34
  /**
29
35
  Removes the key/value pair with the given key, if a key/value pair with the given key exists.
@@ -32,7 +38,7 @@ Dispatches a storage event on Window objects holding an equivalent Storage objec
32
38
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/removeItem)
33
39
  */
34
40
  @send
35
- external removeItem: (storage, string) => unit = "removeItem"
41
+ external removeItem: (t, string) => unit = "removeItem"
36
42
 
37
43
  /**
38
44
  Removes all key/value pairs, if there are any.
@@ -41,4 +47,4 @@ Dispatches a storage event on Window objects holding an equivalent Storage objec
41
47
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/clear)
42
48
  */
43
49
  @send
44
- external clear: storage => unit = "clear"
50
+ external clear: t => unit = "clear"
@@ -1,5 +1,7 @@
1
1
  open WebWorkersTypes
2
2
 
3
+ type t = WebWorkersTypes.sharedWorkerGlobalScope = {...WebWorkersTypes.sharedWorkerGlobalScope}
4
+
3
5
  module Impl = (
4
6
  T: {
5
7
  type t
@@ -24,4 +26,4 @@ self -> SharedWorkerGlobalScope.close
24
26
  external close: T.t => unit = "close"
25
27
  }
26
28
 
27
- include Impl({type t = sharedWorkerGlobalScope})
29
+ include Impl({type t = t})
@@ -1,6 +1,8 @@
1
1
  open WebWorkersTypes
2
2
  open FetchTypes
3
3
 
4
+ type t = WebWorkersTypes.workerGlobalScope = {...WebWorkersTypes.workerGlobalScope}
5
+
4
6
  module Impl = (
5
7
  T: {
6
8
  type t
@@ -8,6 +10,8 @@ module Impl = (
8
10
  ) => {
9
11
  include EventTarget.Impl({type t = T.t})
10
12
 
13
+ external current: T.t = "self"
14
+
11
15
  /**
12
16
  `fetch(workerGlobalScope, string, init)`
13
17
 
@@ -38,4 +42,4 @@ let response = await self->WorkerGlobalScope.fetch(myRequest)
38
42
  external fetchWithRequest: (T.t, request, ~init: requestInit=?) => promise<response> = "fetch"
39
43
  }
40
44
 
41
- include Impl({type t = workerGlobalScope})
45
+ include Impl({type t = t})