@rescript/webapi 0.1.0-alpha-b1d58f9
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/LICENSE +21 -0
- package/README.md +35 -0
- package/package.json +61 -0
- package/rescript.json +557 -0
- package/src/animation/Animation.res +149 -0
- package/src/animation/AnimationEffect.res +71 -0
- package/src/animation/DocumentTimeline.res +8 -0
- package/src/canvas/Canvas.res +179 -0
- package/src/canvas/CanvasGradient.res +11 -0
- package/src/canvas/CanvasPattern.res +11 -0
- package/src/canvas/CanvasRenderingContext2D.res +868 -0
- package/src/canvas/CanvasTypes.res +452 -0
- package/src/canvas/FillStyle.res +25 -0
- package/src/canvas/HTMLCanvasElement.res +101 -0
- package/src/canvas/ImageBitmap.res +6 -0
- package/src/canvas/ImageBitmapRenderingContext.res +9 -0
- package/src/canvas/ImageData.res +17 -0
- package/src/canvas/OffscreenCanvas.res +87 -0
- package/src/canvas/Path2D.res +186 -0
- package/src/canvas/VideoColorSpace.res +11 -0
- package/src/canvas/VideoFrame.res +217 -0
- package/src/core/ArrayBufferTypedArrayOrDataView.res +4 -0
- package/src/core/DOM.res +1026 -0
- package/src/core/EventType.res +108 -0
- package/src/crypto/Crypto.res +11 -0
- package/src/crypto/SubtleCrypto.res +173 -0
- package/src/crypto/WebCryptoTypes.res +71 -0
- package/src/css-font-loading/BaseCSSFontLoading.res +24 -0
- package/src/css-font-loading/CssFontLoadingTypes.res +92 -0
- package/src/css-font-loading/FontFace.res +62 -0
- package/src/css-font-loading/FontFaceSet.res +38 -0
- package/src/cssom/CSSRuleList.res +5 -0
- package/src/cssom/CSSStyleDeclaration.res +1734 -0
- package/src/cssom/CSSStyleValue.res +17 -0
- package/src/cssom/MediaList.res +29 -0
- package/src/cssom/MediaQueryList.res +18 -0
- package/src/cssom/StylePropertyMap.res +56 -0
- package/src/cssom/StylePropertyMapReadOnly.res +22 -0
- package/src/cssom/StyleSheet.res +152 -0
- package/src/cssom/StyleSheetList.res +17 -0
- package/src/device/GamepadHapticActuator.res +16 -0
- package/src/device/GamepadTypes.res +86 -0
- package/src/device/Geolocation.res +31 -0
- package/src/device/GeolocationCoordinates.res +5 -0
- package/src/device/GeolocationPosition.res +5 -0
- package/src/device/GeolocationTypes.res +81 -0
- package/src/device/LockManager.res +26 -0
- package/src/device/ScreenOrientation.res +7 -0
- package/src/device/ScreenWakeLockTypes.res +26 -0
- package/src/device/WakeLock.res +8 -0
- package/src/device/WakeLockSentinel.res +7 -0
- package/src/device/WebLocksTypes.res +45 -0
- package/src/device/WebMIDI.res +7 -0
- package/src/device/WebMidiTypes.res +36 -0
- package/src/dom-nodes/AbstractRange.res +30 -0
- package/src/dom-nodes/Attr.res +101 -0
- package/src/dom-nodes/CDATASection.res +7 -0
- package/src/dom-nodes/CaretPosition.res +2 -0
- package/src/dom-nodes/CharacterData.res +199 -0
- package/src/dom-nodes/Comment.res +15 -0
- package/src/dom-nodes/DOMImplementation.res +131 -0
- package/src/dom-nodes/DOMTree.res +1653 -0
- package/src/dom-nodes/DocumentFragment.res +96 -0
- package/src/dom-nodes/Element.res +509 -0
- package/src/dom-nodes/ElementInternals.res +39 -0
- package/src/dom-nodes/HTML.res +11 -0
- package/src/dom-nodes/HTMLCollection.res +25 -0
- package/src/dom-nodes/NamedNodeMap.res +46 -0
- package/src/dom-nodes/Node.res +114 -0
- package/src/dom-nodes/NodeFilter.res +4 -0
- package/src/dom-nodes/NodeIterator.res +38 -0
- package/src/dom-nodes/NodeList.res +6 -0
- package/src/dom-nodes/ProcessingInstruction.res +15 -0
- package/src/dom-nodes/Range.res +156 -0
- package/src/dom-nodes/Selection.res +137 -0
- package/src/dom-nodes/ShadowRoot.res +23 -0
- package/src/dom-nodes/StaticRange.res +6 -0
- package/src/dom-nodes/Text.res +31 -0
- package/src/dom-nodes/TreeWalker.res +65 -0
- package/src/dom-platform/DOMException.res +7 -0
- package/src/dom-platform/DOMStringList.res +15 -0
- package/src/dom-platform/DOMStringMap.res +5 -0
- package/src/dom-platform/DOMTokenList.res +70 -0
- package/src/event/AbortController.res +9 -0
- package/src/event/AbortSignal.res +25 -0
- package/src/event/Event.res +76 -0
- package/src/event/EventTarget.res +91 -0
- package/src/event/ExtendableEvent.res +14 -0
- package/src/fetch/BodyInit.res +46 -0
- package/src/fetch/Fetch.res +12 -0
- package/src/fetch/FetchTypes.res +282 -0
- package/src/fetch/FormData.res +71 -0
- package/src/fetch/FormDataEntryValue.res +2 -0
- package/src/fetch/Headers.res +59 -0
- package/src/fetch/HeadersInit.res +16 -0
- package/src/fetch/Request.res +61 -0
- package/src/fetch/Response.res +127 -0
- package/src/file/BaseFileAndDirectoryEntries.res +72 -0
- package/src/file/Blob.res +48 -0
- package/src/file/File.res +15 -0
- package/src/file/FileAndDirectoryEntriesTypes.res +35 -0
- package/src/file/FileList.res +16 -0
- package/src/file/FileSystemDirectoryEntry.res +42 -0
- package/src/file/FileSystemDirectoryHandle.res +49 -0
- package/src/file/FileSystemDirectoryReader.res +9 -0
- package/src/file/FileSystemEntry.res +9 -0
- package/src/file/FileSystemFileHandle.res +25 -0
- package/src/file/FileSystemHandle.res +6 -0
- package/src/file/FileSystemWritableFileStream.res +65 -0
- package/src/file/FileTypes.res +225 -0
- package/src/file/ReadableStream.res +79 -0
- package/src/file/WritableStream.res +27 -0
- package/src/file/WritableStreamDefaultController.res +5 -0
- package/src/geometry/DOMMatrix.res +206 -0
- package/src/geometry/DOMMatrixReadOnly.res +140 -0
- package/src/geometry/DOMPoint.res +28 -0
- package/src/geometry/DOMPointReadOnly.res +22 -0
- package/src/geometry/DOMRect.res +22 -0
- package/src/geometry/DOMRectList.res +2 -0
- package/src/geometry/DOMRectReadOnly.res +19 -0
- package/src/html/HTMLAnchorElement.res +373 -0
- package/src/html/HTMLAreaElement.res +353 -0
- package/src/html/HTMLBRElement.res +9 -0
- package/src/html/HTMLBaseElement.res +20 -0
- package/src/html/HTMLBodyElement.res +9 -0
- package/src/html/HTMLButtonElement.res +98 -0
- package/src/html/HTMLDListElement.res +9 -0
- package/src/html/HTMLDataElement.res +14 -0
- package/src/html/HTMLDataListElement.res +14 -0
- package/src/html/HTMLDialogElement.res +40 -0
- package/src/html/HTMLDivElement.res +9 -0
- package/src/html/HTMLElement.res +108 -0
- package/src/html/HTMLEmbedElement.res +275 -0
- package/src/html/HTMLFieldSetElement.res +70 -0
- package/src/html/HTMLFormControlsCollection.res +21 -0
- package/src/html/HTMLFormElement.res +39 -0
- package/src/html/HTMLFrameSetElement.res +9 -0
- package/src/html/HTMLHRElement.res +9 -0
- package/src/html/HTMLHeadElement.res +256 -0
- package/src/html/HTMLHeadingElement.res +9 -0
- package/src/html/HTMLHtmlElement.res +9 -0
- package/src/html/HTMLIFrameElement.res +69 -0
- package/src/html/HTMLImageElement.res +349 -0
- package/src/html/HTMLInputElement.res +310 -0
- package/src/html/HTMLLIElement.res +9 -0
- package/src/html/HTMLLabelElement.res +25 -0
- package/src/html/HTMLLegendElement.res +14 -0
- package/src/html/HTMLLinkElement.res +69 -0
- package/src/html/HTMLMapElement.res +20 -0
- package/src/html/HTMLMenuElement.res +8 -0
- package/src/html/HTMLMetaElement.res +29 -0
- package/src/html/HTMLMeterElement.res +38 -0
- package/src/html/HTMLModElement.res +9 -0
- package/src/html/HTMLOListElement.res +24 -0
- package/src/html/HTMLObjectElement.res +89 -0
- package/src/html/HTMLOptGroupElement.res +19 -0
- package/src/html/HTMLOptionElement.res +49 -0
- package/src/html/HTMLOptionsCollection.res +35 -0
- package/src/html/HTMLOutputElement.res +73 -0
- package/src/html/HTMLParagraphElement.res +9 -0
- package/src/html/HTMLPictureElement.res +9 -0
- package/src/html/HTMLPreElement.res +9 -0
- package/src/html/HTMLProgressElement.res +29 -0
- package/src/html/HTMLQuoteElement.res +9 -0
- package/src/html/HTMLScriptElement.res +310 -0
- package/src/html/HTMLSelectElement.res +157 -0
- package/src/html/HTMLSlotElement.res +34 -0
- package/src/html/HTMLSourceElement.res +18 -0
- package/src/html/HTMLSpanElement.res +9 -0
- package/src/html/HTMLStyleElement.res +24 -0
- package/src/html/HTMLTableCaptionElement.res +9 -0
- package/src/html/HTMLTableCellElement.res +40 -0
- package/src/html/HTMLTableElement.res +100 -0
- package/src/html/HTMLTableRowElement.res +40 -0
- package/src/html/HTMLTableSectionElement.res +30 -0
- package/src/html/HTMLTemplateElement.res +31 -0
- package/src/html/HTMLTextAreaElement.res +177 -0
- package/src/html/HTMLTimeElement.res +14 -0
- package/src/html/HTMLTitleElement.res +15 -0
- package/src/html/HTMLUListElement.res +9 -0
- package/src/html/HTMLUnknownElement.res +9 -0
- package/src/media/BaseEncryptedMediaExtensions.res +97 -0
- package/src/media/DomHTMLMediaElement.res +206 -0
- package/src/media/EncryptedMediaExtensionsHTMLMediaElement.res +15 -0
- package/src/media/EncryptedMediaExtensionsTypes.res +43 -0
- package/src/media/HTMLAudioElement.res +9 -0
- package/src/media/HTMLTrackElement.res +14 -0
- package/src/media/HTMLVideoElement.res +78 -0
- package/src/media/MediaCapabilities.res +19 -0
- package/src/media/MediaCapabilitiesTypes.res +83 -0
- package/src/media/MediaCaptureAndStreamsTypes.res +197 -0
- package/src/media/MediaDeviceInfo.res +9 -0
- package/src/media/MediaDevices.res +40 -0
- package/src/media/MediaError.res +14 -0
- package/src/media/MediaKeySession.res +53 -0
- package/src/media/MediaKeyStatusMap.res +11 -0
- package/src/media/MediaKeySystemAccess.res +14 -0
- package/src/media/MediaKeys.res +35 -0
- package/src/media/MediaMetadata.res +10 -0
- package/src/media/MediaSession.res +25 -0
- package/src/media/MediaSessionTypes.res +85 -0
- package/src/media/MediaStream.res +89 -0
- package/src/media/MediaStreamTrack.res +51 -0
- package/src/media/PictureInPicture.res +7 -0
- package/src/media/PictureInPictureTypes.res +17 -0
- package/src/media/RemotePlayback.res +25 -0
- package/src/media/RemotePlaybackTypes.res +20 -0
- package/src/media/SpeechSynthesis.res +33 -0
- package/src/media/SpeechSynthesisUtterance.res +8 -0
- package/src/media/TextTrack.res +15 -0
- package/src/media/TextTrackCueList.res +9 -0
- package/src/media/TextTrackList.res +17 -0
- package/src/media/TimeRanges.res +29 -0
- package/src/media/VideoPlaybackQuality.res +18 -0
- package/src/media/WebSpeechTypes.res +83 -0
- package/src/media/WebVttTypes.res +123 -0
- package/src/messaging/ApplicationServerKey.res +2 -0
- package/src/messaging/ChannelMessagingTypes.res +12 -0
- package/src/messaging/CloseEvent.res +10 -0
- package/src/messaging/MessageEvent.res +43 -0
- package/src/messaging/MessagePort.res +38 -0
- package/src/messaging/Notification.res +46 -0
- package/src/messaging/NotificationTypes.res +107 -0
- package/src/messaging/PushEvent.res +3 -0
- package/src/messaging/PushManager.res +24 -0
- package/src/messaging/PushMessageData.res +15 -0
- package/src/messaging/PushSubscription.res +20 -0
- package/src/messaging/PushTypes.res +88 -0
- package/src/messaging/WebSocket.res +74 -0
- package/src/messaging/WebSocketsTypes.res +124 -0
- package/src/navigator/Clipboard.res +29 -0
- package/src/navigator/ClipboardItem.res +20 -0
- package/src/navigator/ClipboardTypes.res +31 -0
- package/src/navigator/CredentialManagementTypes.res +138 -0
- package/src/navigator/CredentialsContainer.res +33 -0
- package/src/navigator/Navigator.res +166 -0
- package/src/navigator/Permissions.res +10 -0
- package/src/navigator/PermissionsTypes.res +38 -0
- package/src/observers/IntersectionObserver.res +36 -0
- package/src/observers/IntersectionObserverRoot.res +23 -0
- package/src/observers/IntersectionObserverTypes.res +67 -0
- package/src/observers/MutationObserver.res +94 -0
- package/src/observers/ResizeObserver.res +30 -0
- package/src/observers/ResizeObserverTypes.res +56 -0
- package/src/performance/Performance.res +101 -0
- package/src/performance/PerformanceEntry.res +5 -0
- package/src/performance/PerformanceMark.res +16 -0
- package/src/performance/PerformanceTypes.res +86 -0
- package/src/storage/Cache.res +117 -0
- package/src/storage/CacheStorage.res +43 -0
- package/src/storage/CacheTypes.res +24 -0
- package/src/storage/IDBDatabase.res +54 -0
- package/src/storage/IDBFactory.res +34 -0
- package/src/storage/IDBIndex.res +83 -0
- package/src/storage/IDBObjectStore.res +183 -0
- package/src/storage/IDBTransaction.res +22 -0
- package/src/storage/IndexedDbTypes.res +213 -0
- package/src/storage/Storage.res +42 -0
- package/src/storage/StorageEvent.res +10 -0
- package/src/storage/StorageManager.res +24 -0
- package/src/storage/StorageTypes.res +11 -0
- package/src/storage/WebStorageTypes.res +57 -0
- package/src/svg/SVGElement.res +115 -0
- package/src/svg/SVGGraphicsElement.res +16 -0
- package/src/svg/SVGLength.res +9 -0
- package/src/ui-events/CompositionEvent.res +10 -0
- package/src/ui-events/DataTransfer.res +38 -0
- package/src/ui-events/DataTransferItem.res +21 -0
- package/src/ui-events/DataTransferItemList.res +34 -0
- package/src/ui-events/FocusEvent.res +10 -0
- package/src/ui-events/InputEvent.res +16 -0
- package/src/ui-events/KeyboardEvent.res +16 -0
- package/src/ui-events/MouseEvent.res +26 -0
- package/src/ui-events/PointerEvent.res +24 -0
- package/src/ui-events/Touch.res +5 -0
- package/src/ui-events/TouchEvent.res +10 -0
- package/src/ui-events/TouchList.res +5 -0
- package/src/ui-events/UIEvent.res +20 -0
- package/src/ui-events/UiEventsTypes.res +590 -0
- package/src/ui-events/WheelEvent.res +10 -0
- package/src/url/URL.res +38 -0
- package/src/url/URLSearchParams.res +104 -0
- package/src/url/UrlTypes.res +69 -0
- package/src/view-transitions/ViewTransition.res +5 -0
- package/src/view-transitions/ViewTransitionsTypes.res +22 -0
- package/src/web-audio/AnalyserNode.res +38 -0
- package/src/web-audio/AudioBuffer.res +33 -0
- package/src/web-audio/AudioBufferSourceNode.res +21 -0
- package/src/web-audio/AudioContext.res +59 -0
- package/src/web-audio/AudioDestinationNode.res +1 -0
- package/src/web-audio/AudioNode.res +76 -0
- package/src/web-audio/AudioParam.res +65 -0
- package/src/web-audio/AudioProcessingEvent.res +10 -0
- package/src/web-audio/AudioScheduledSourceNode.res +23 -0
- package/src/web-audio/AudioWorkletNode.res +11 -0
- package/src/web-audio/BaseAudioContext.res +141 -0
- package/src/web-audio/BiquadFilterNode.res +21 -0
- package/src/web-audio/ChannelMergerNode.res +10 -0
- package/src/web-audio/ChannelSplitterNode.res +10 -0
- package/src/web-audio/ConstantSourceNode.res +10 -0
- package/src/web-audio/ConvolverNode.res +10 -0
- package/src/web-audio/DelayNode.res +10 -0
- package/src/web-audio/DynamicsCompressorNode.res +10 -0
- package/src/web-audio/GainNode.res +10 -0
- package/src/web-audio/IIRFilterNode.res +21 -0
- package/src/web-audio/MediaElementAudioSourceNode.res +10 -0
- package/src/web-audio/MediaStreamAudioDestinationNode.res +10 -0
- package/src/web-audio/MediaStreamAudioSourceNode.res +10 -0
- package/src/web-audio/OfflineAudioCompletionEvent.res +10 -0
- package/src/web-audio/OfflineAudioContext.res +58 -0
- package/src/web-audio/OscillatorNode.res +17 -0
- package/src/web-audio/PannerNode.res +10 -0
- package/src/web-audio/PeriodicWave.res +8 -0
- package/src/web-audio/StereoPannerNode.res +10 -0
- package/src/web-audio/WaveShaperNode.res +10 -0
- package/src/web-audio/WebAudioTypes.res +1309 -0
- package/src/web-audio/Worklet.res +14 -0
- package/src/window/CustomElementRegistry.res +30 -0
- package/src/window/Document.res +470 -0
- package/src/window/DomGlobal.res +459 -0
- package/src/window/History.res +37 -0
- package/src/window/HistoryTypes.res +26 -0
- package/src/window/IdleDeadline.res +5 -0
- package/src/window/Location.res +108 -0
- package/src/window/VisualViewport.res +5 -0
- package/src/window/VisualViewportTypes.res +37 -0
- package/src/window/Window.res +556 -0
- package/src/window/XPathExpression.res +16 -0
- package/src/window/XPathResult.res +46 -0
- package/src/workers/Clients.res +39 -0
- package/src/workers/NavigationPreloadManager.res +26 -0
- package/src/workers/ServiceWorker.res +38 -0
- package/src/workers/ServiceWorkerContainer.res +34 -0
- package/src/workers/ServiceWorkerRegistration.res +32 -0
- package/src/workers/ServiceWorkerScope.res +12 -0
- package/src/workers/ServiceWorkerTypes.res +153 -0
- package/src/workers/SharedWorker.res +68 -0
- package/src/workers/SharedWorkerScope.res +29 -0
- package/src/workers/WebWorkersTypes.res +46 -0
- package/src/workers/Worker.res +48 -0
- package/src/workers/WorkerLocation.res +18 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
type t = ServiceWorkerTypes.serviceWorker = private {...ServiceWorkerTypes.serviceWorker}
|
|
2
|
+
|
|
3
|
+
include EventTarget.Impl({type t = t})
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/postMessage)
|
|
7
|
+
*/
|
|
8
|
+
@send
|
|
9
|
+
external postMessage: (t, ~message: JSON.t, ~transfer: array<Dict.t<string>>) => unit =
|
|
10
|
+
"postMessage"
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/postMessage)
|
|
14
|
+
*/
|
|
15
|
+
@send
|
|
16
|
+
external postMessage2: (
|
|
17
|
+
t,
|
|
18
|
+
~message: JSON.t,
|
|
19
|
+
~options: MessagePort.structuredSerializeOptions=?,
|
|
20
|
+
) => unit = "postMessage"
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/postMessage)
|
|
24
|
+
*/
|
|
25
|
+
@send
|
|
26
|
+
external postMessageWithOptions: (
|
|
27
|
+
t,
|
|
28
|
+
~message: JSON.t,
|
|
29
|
+
~options: MessagePort.structuredSerializeOptions=?,
|
|
30
|
+
) => unit = "postMessage"
|
|
31
|
+
|
|
32
|
+
module Cache = Cache
|
|
33
|
+
module Clients = Clients
|
|
34
|
+
module NavigationPreloadManager = NavigationPreloadManager
|
|
35
|
+
module ServiceWorkerContainer = ServiceWorkerContainer
|
|
36
|
+
module ServiceWorkerScope = ServiceWorkerScope
|
|
37
|
+
module ServiceWorkerRegistration = ServiceWorkerRegistration
|
|
38
|
+
module Types = ServiceWorkerTypes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
include EventTarget.Impl({type t = ServiceWorkerTypes.serviceWorkerContainer})
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/register)
|
|
5
|
+
*/
|
|
6
|
+
@send
|
|
7
|
+
external register: (
|
|
8
|
+
ServiceWorkerTypes.serviceWorkerContainer,
|
|
9
|
+
string,
|
|
10
|
+
~options: ServiceWorkerTypes.registrationOptions=?,
|
|
11
|
+
) => promise<ServiceWorkerTypes.serviceWorkerRegistration> = "register"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/getRegistration)
|
|
15
|
+
*/
|
|
16
|
+
@send
|
|
17
|
+
external getRegistration: (
|
|
18
|
+
ServiceWorkerTypes.serviceWorkerContainer,
|
|
19
|
+
~clientURL: string=?,
|
|
20
|
+
) => promise<option<ServiceWorkerTypes.serviceWorkerRegistration>> = "getRegistration"
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/getRegistrations)
|
|
24
|
+
*/
|
|
25
|
+
@send
|
|
26
|
+
external getRegistrations: ServiceWorkerTypes.serviceWorkerContainer => promise<
|
|
27
|
+
array<ServiceWorkerTypes.serviceWorkerRegistration>,
|
|
28
|
+
> = "getRegistrations"
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/startMessages)
|
|
32
|
+
*/
|
|
33
|
+
@send
|
|
34
|
+
external startMessages: ServiceWorkerTypes.serviceWorkerContainer => unit = "startMessages"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
include EventTarget.Impl({type t = ServiceWorkerTypes.serviceWorkerRegistration})
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/update)
|
|
5
|
+
*/
|
|
6
|
+
@send
|
|
7
|
+
external update: ServiceWorkerTypes.serviceWorkerRegistration => promise<unit> = "update"
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/unregister)
|
|
11
|
+
*/
|
|
12
|
+
@send
|
|
13
|
+
external unregister: ServiceWorkerTypes.serviceWorkerRegistration => promise<bool> = "unregister"
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/showNotification)
|
|
17
|
+
*/
|
|
18
|
+
@send
|
|
19
|
+
external showNotification: (
|
|
20
|
+
ServiceWorkerTypes.serviceWorkerRegistration,
|
|
21
|
+
~title: string,
|
|
22
|
+
~options: NotificationTypes.notificationOptions=?,
|
|
23
|
+
) => promise<unit> = "showNotification"
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/getNotifications)
|
|
27
|
+
*/
|
|
28
|
+
@send
|
|
29
|
+
external getNotifications: (
|
|
30
|
+
ServiceWorkerTypes.serviceWorkerRegistration,
|
|
31
|
+
~filter: NotificationTypes.getNotificationOptions=?,
|
|
32
|
+
) => promise<array<NotificationTypes.notification>> = "getNotifications"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type t = ServiceWorkerTypes.serviceWorkerGlobalScope = private {
|
|
2
|
+
...ServiceWorkerTypes.serviceWorkerGlobalScope,
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
include Worker.Impl({type t = t})
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
Forces the waiting service worker to become the active service worker.
|
|
9
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting)
|
|
10
|
+
*/
|
|
11
|
+
@send
|
|
12
|
+
external skipWaiting: t => promise<unit> = "skipWaiting"
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
@@warning("-30")
|
|
2
|
+
|
|
3
|
+
type serviceWorkerState =
|
|
4
|
+
| @as("activated") Activated
|
|
5
|
+
| @as("activating") Activating
|
|
6
|
+
| @as("installed") Installed
|
|
7
|
+
| @as("installing") Installing
|
|
8
|
+
| @as("parsed") Parsed
|
|
9
|
+
| @as("redundant") Redundant
|
|
10
|
+
|
|
11
|
+
type serviceWorkerUpdateViaCache =
|
|
12
|
+
| @as("all") All
|
|
13
|
+
| @as("imports") Imports
|
|
14
|
+
| @as("none") None
|
|
15
|
+
|
|
16
|
+
type workerType =
|
|
17
|
+
| @as("classic") Classic
|
|
18
|
+
| @as("module") Module
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
This WebApiServiceWorker API interface provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique WebApiServiceWorker object.
|
|
22
|
+
[See WebApiServiceWorker on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker)
|
|
23
|
+
*/
|
|
24
|
+
@editor.completeFrom(ServiceWorker)
|
|
25
|
+
type serviceWorker = private {
|
|
26
|
+
...DOM.eventTarget,
|
|
27
|
+
/**
|
|
28
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/scriptURL)
|
|
29
|
+
*/
|
|
30
|
+
scriptURL: string,
|
|
31
|
+
/**
|
|
32
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorker/state)
|
|
33
|
+
*/
|
|
34
|
+
state: serviceWorkerState,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
[See NavigationPreloadManager on MDN](https://developer.mozilla.org/docs/Web/API/NavigationPreloadManager)
|
|
39
|
+
*/
|
|
40
|
+
@editor.completeFrom(NavigationPreloadManager)
|
|
41
|
+
type navigationPreloadManager = private {}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
This WebApiServiceWorker API interface represents the service worker registration. You register a service worker to control one or more pages that share the same origin.
|
|
45
|
+
[See ServiceWorkerRegistration on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration)
|
|
46
|
+
*/
|
|
47
|
+
@editor.completeFrom(ServiceWorkerRegistration)
|
|
48
|
+
type serviceWorkerRegistration = private {
|
|
49
|
+
...DOM.eventTarget,
|
|
50
|
+
/**
|
|
51
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/installing)
|
|
52
|
+
*/
|
|
53
|
+
installing: Null.t<serviceWorker>,
|
|
54
|
+
/**
|
|
55
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/waiting)
|
|
56
|
+
*/
|
|
57
|
+
waiting: Null.t<serviceWorker>,
|
|
58
|
+
/**
|
|
59
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/active)
|
|
60
|
+
*/
|
|
61
|
+
active: Null.t<serviceWorker>,
|
|
62
|
+
/**
|
|
63
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/navigationPreload)
|
|
64
|
+
*/
|
|
65
|
+
navigationPreload: navigationPreloadManager,
|
|
66
|
+
/**
|
|
67
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/scope)
|
|
68
|
+
*/
|
|
69
|
+
scope: string,
|
|
70
|
+
/**
|
|
71
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/updateViaCache)
|
|
72
|
+
*/
|
|
73
|
+
updateViaCache: serviceWorkerUpdateViaCache,
|
|
74
|
+
/**
|
|
75
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerRegistration/pushManager)
|
|
76
|
+
*/
|
|
77
|
+
pushManager: PushTypes.pushManager,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
The ServiceWorkerContainer interface of the WebApiServiceWorker API provides an object representing the service worker as an overall unit in the network ecosystem, including facilities to register, unregister and update service workers, and access the state of service workers and their registrations.
|
|
82
|
+
[See ServiceWorkerContainer on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer)
|
|
83
|
+
*/
|
|
84
|
+
@editor.completeFrom(ServiceWorkerContainer)
|
|
85
|
+
type serviceWorkerContainer = private {
|
|
86
|
+
...DOM.eventTarget,
|
|
87
|
+
/**
|
|
88
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/controller)
|
|
89
|
+
*/
|
|
90
|
+
controller: Null.t<serviceWorker>,
|
|
91
|
+
/**
|
|
92
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerContainer/ready)
|
|
93
|
+
*/
|
|
94
|
+
ready: promise<serviceWorkerRegistration>,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
type navigationPreloadState = {
|
|
98
|
+
mutable enabled?: bool,
|
|
99
|
+
mutable headerValue?: string,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type registrationOptions = {
|
|
103
|
+
mutable scope?: string,
|
|
104
|
+
@as("type") mutable type_?: WebWorkersTypes.workerType,
|
|
105
|
+
mutable updateViaCache?: serviceWorkerUpdateViaCache,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
type requestInfo = unknown
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
The Clients interface provides access to Client objects. Access it via self.clients within a service worker.
|
|
112
|
+
[See Clients on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Clients)
|
|
113
|
+
*/
|
|
114
|
+
@editor.completeFrom(Clients)
|
|
115
|
+
type clients
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
The ServiceWorkerGlobalScope interface of the Service Worker API represents the global execution context of a service worker.
|
|
119
|
+
[See ServiceWorkerGlobalScope on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope)
|
|
120
|
+
*/
|
|
121
|
+
@editor.completeFrom(ServiceWorkerScope)
|
|
122
|
+
type serviceWorkerGlobalScope = private {
|
|
123
|
+
...WebWorkersTypes.workerGlobalScope,
|
|
124
|
+
/**
|
|
125
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/clients)
|
|
126
|
+
*/
|
|
127
|
+
clients: clients,
|
|
128
|
+
/**
|
|
129
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerGlobalScope/registration)
|
|
130
|
+
*/
|
|
131
|
+
registration: serviceWorkerRegistration,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
The Client interface represents an executable context such as a Worker, or a SharedWorker. Window clients are represented by the more-specific WindowClient.
|
|
136
|
+
[See Client on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Client)
|
|
137
|
+
*/
|
|
138
|
+
type client = {
|
|
139
|
+
/**
|
|
140
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Client/id)
|
|
141
|
+
*/
|
|
142
|
+
id: string,
|
|
143
|
+
/** [Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Client/url) */
|
|
144
|
+
url: string,
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
The WindowClient interface of the WebApiServiceWorker API represents the scope of a service worker client that is a document in a browsing context, controlled by an active worker.
|
|
149
|
+
[See WindowClient on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WindowClient)
|
|
150
|
+
*/
|
|
151
|
+
type windowClient = {
|
|
152
|
+
...client,
|
|
153
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
type t = WebWorkersTypes.sharedWorker
|
|
2
|
+
type workerType = WebWorkersTypes.workerType
|
|
3
|
+
type workerOptions = WebWorkersTypes.workerOptions = {...WebWorkersTypes.workerOptions}
|
|
4
|
+
|
|
5
|
+
include EventTarget.Impl({type t = t})
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
`make(string)`
|
|
9
|
+
|
|
10
|
+
The SharedWorker() constructor creates a SharedWorker object that executes the
|
|
11
|
+
script at the specified URL. This script must obey the same-origin policy.
|
|
12
|
+
|
|
13
|
+
```res
|
|
14
|
+
let shared: SharedWorker.t = SharedWorker.make("sharedworker.js")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/)
|
|
18
|
+
*/
|
|
19
|
+
@throws(JsExn) @new
|
|
20
|
+
external make: string => t = "SharedWorker"
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
`makeWithName(string, string)`
|
|
24
|
+
|
|
25
|
+
The SharedWorker() constructor creates a SharedWorker object that executes the
|
|
26
|
+
script at the specified URL. This script must obey the same-origin policy.
|
|
27
|
+
|
|
28
|
+
```res
|
|
29
|
+
let shared: SharedWorker.t = SharedWorker.makeWithName("sharedworker.js", "name")
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/)
|
|
33
|
+
*/
|
|
34
|
+
@throws(JsExn) @new
|
|
35
|
+
external makeWithName: (string, string) => t = "SharedWorker"
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
`makeWithOptions(string, workerOptions)`
|
|
39
|
+
|
|
40
|
+
The SharedWorker() constructor creates a SharedWorker object that executes the
|
|
41
|
+
script at the specified URL. This script must obey the same-origin policy.
|
|
42
|
+
|
|
43
|
+
```res
|
|
44
|
+
let shared: SharedWorker.t = SharedWorker.makeWithOptions("sharedworker.js", {
|
|
45
|
+
name: "workerName",
|
|
46
|
+
type_: Module,
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/)
|
|
51
|
+
*/
|
|
52
|
+
@throws(JsExn) @new
|
|
53
|
+
external makeWithOptions: (string, workerOptions) => t = "SharedWorker"
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
`port(sharedWorker)`
|
|
57
|
+
|
|
58
|
+
The port property of the SharedWorker interface returns a MessagePort object
|
|
59
|
+
used to communicate and control the shared worker.
|
|
60
|
+
|
|
61
|
+
```res
|
|
62
|
+
let port: MessagePort.t = SharedWorker.port(myWorker)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/port)
|
|
66
|
+
*/
|
|
67
|
+
@get
|
|
68
|
+
external port: t => MessagePort.t = "port"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type t = WebWorkersTypes.sharedWorkerGlobalScope = private {
|
|
2
|
+
...WebWorkersTypes.sharedWorkerGlobalScope,
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
module Impl = (
|
|
6
|
+
T: {
|
|
7
|
+
type t
|
|
8
|
+
},
|
|
9
|
+
) => {
|
|
10
|
+
include Worker.Impl({type t = T.t})
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
`close(sharedWorkerGlobalScope)`
|
|
14
|
+
|
|
15
|
+
The close() method of the SharedWorkerGlobalScope interface discards any tasks
|
|
16
|
+
queued in the SharedWorkerGlobalScope's event loop, effectively closing this
|
|
17
|
+
particular scope.
|
|
18
|
+
|
|
19
|
+
```res
|
|
20
|
+
self -> SharedWorkerScope.close
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorkerGlobalScope/close)
|
|
24
|
+
*/
|
|
25
|
+
@send
|
|
26
|
+
external close: T.t => unit = "close"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
include Impl({type t = t})
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@editor.completeFrom(SharedWorker) type sharedWorker
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
The WorkerGlobalScope interface of the Web Workers API is an interface representing the scope of any worker.
|
|
5
|
+
Workers have no browsing context; this scope contains the information usually conveyed by Window objects —
|
|
6
|
+
in this case event handlers, the console or the associated WorkerNavigator object.
|
|
7
|
+
Each WorkerGlobalScope has its own event loop.
|
|
8
|
+
[See WorkerGlobalScope on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope)
|
|
9
|
+
*/
|
|
10
|
+
@editor.completeFrom(WorkerGlobalScope)
|
|
11
|
+
type workerGlobalScope = private {
|
|
12
|
+
...DOM.eventTarget,
|
|
13
|
+
/**
|
|
14
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/caches)
|
|
15
|
+
*/
|
|
16
|
+
caches: CacheTypes.cacheStorage,
|
|
17
|
+
/**
|
|
18
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/crossOriginIsolated)
|
|
19
|
+
*/
|
|
20
|
+
crossOriginIsolated: bool,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
type workerType =
|
|
24
|
+
| @as("classic") Classic
|
|
25
|
+
| @as("module") Module
|
|
26
|
+
|
|
27
|
+
/** An object containing option properties that can set when creating the
|
|
28
|
+
object instance. */
|
|
29
|
+
type workerOptions = {
|
|
30
|
+
@as("type") mutable type_?: workerType,
|
|
31
|
+
mutable credentials?: FetchTypes.requestCredentials,
|
|
32
|
+
mutable name?: string,
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
The `SharedWorkerGlobalScope` object (the `SharedWorker` global scope) is
|
|
37
|
+
accessible through the self keyword. Some additional global functions,
|
|
38
|
+
namespaces objects, and constructors, not typically associated with the worker
|
|
39
|
+
global scope, but available on it, are listed in the JavaScript Reference. See
|
|
40
|
+
the complete list of functions available to workers.
|
|
41
|
+
*/
|
|
42
|
+
@editor.completeFrom(SharedWorkerScope)
|
|
43
|
+
type sharedWorkerGlobalScope = private {
|
|
44
|
+
...workerGlobalScope,
|
|
45
|
+
name: string,
|
|
46
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module Impl = (
|
|
2
|
+
T: {
|
|
3
|
+
type t
|
|
4
|
+
},
|
|
5
|
+
) => {
|
|
6
|
+
include EventTarget.Impl({type t = T.t})
|
|
7
|
+
|
|
8
|
+
external current: T.t = "self"
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
The absolute URL of the script executed by this worker.
|
|
12
|
+
[See WorkerGlobalScope.location on MDN](https://developer.mozilla.org/docs/Web/API/WorkerGlobalScope/location)
|
|
13
|
+
*/
|
|
14
|
+
@get
|
|
15
|
+
external location: T.t => WorkerLocation.t = "location"
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
`fetch(workerGlobalScope, string, init)`
|
|
19
|
+
|
|
20
|
+
The fetch() method of the WorkerGlobalScope interface starts the process of fetching a resource from the network,
|
|
21
|
+
returning a promise that is fulfilled once the response is available.
|
|
22
|
+
|
|
23
|
+
```res
|
|
24
|
+
let response = await self->Worker.fetch("https://rescript-lang.org")
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/fetch)
|
|
28
|
+
*/
|
|
29
|
+
@send
|
|
30
|
+
external fetch: (T.t, string, ~init: Request.requestInit=?) => promise<Response.t> = "fetch"
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
`fetchWithRequest(workerGlobalScope, request, init)`
|
|
34
|
+
|
|
35
|
+
The fetch() method of the WorkerGlobalScope interface starts the process of fetching a resource from the network,
|
|
36
|
+
returning a promise that is fulfilled once the response is available.
|
|
37
|
+
|
|
38
|
+
```res
|
|
39
|
+
let response = await self->Worker.fetch(myRequest)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/fetch)
|
|
43
|
+
*/
|
|
44
|
+
external fetchWithRequest: (T.t, Request.t, ~init: Request.requestInit=?) => promise<Response.t> =
|
|
45
|
+
"fetch"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
include Impl({type t = WebWorkersTypes.workerGlobalScope})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
The absolute URL of the script executed by a worker.
|
|
3
|
+
[See WorkerLocation on MDN](https://developer.mozilla.org/docs/Web/API/WorkerLocation)
|
|
4
|
+
*/
|
|
5
|
+
type t = private {
|
|
6
|
+
href: string,
|
|
7
|
+
origin: string,
|
|
8
|
+
protocol: string,
|
|
9
|
+
host: string,
|
|
10
|
+
hostname: string,
|
|
11
|
+
port: string,
|
|
12
|
+
pathname: string,
|
|
13
|
+
search: string,
|
|
14
|
+
hash: string,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@send
|
|
18
|
+
external toString: t => string = "toString"
|