@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.
Files changed (341) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/package.json +61 -0
  4. package/rescript.json +557 -0
  5. package/src/animation/Animation.res +149 -0
  6. package/src/animation/AnimationEffect.res +71 -0
  7. package/src/animation/DocumentTimeline.res +8 -0
  8. package/src/canvas/Canvas.res +179 -0
  9. package/src/canvas/CanvasGradient.res +11 -0
  10. package/src/canvas/CanvasPattern.res +11 -0
  11. package/src/canvas/CanvasRenderingContext2D.res +868 -0
  12. package/src/canvas/CanvasTypes.res +452 -0
  13. package/src/canvas/FillStyle.res +25 -0
  14. package/src/canvas/HTMLCanvasElement.res +101 -0
  15. package/src/canvas/ImageBitmap.res +6 -0
  16. package/src/canvas/ImageBitmapRenderingContext.res +9 -0
  17. package/src/canvas/ImageData.res +17 -0
  18. package/src/canvas/OffscreenCanvas.res +87 -0
  19. package/src/canvas/Path2D.res +186 -0
  20. package/src/canvas/VideoColorSpace.res +11 -0
  21. package/src/canvas/VideoFrame.res +217 -0
  22. package/src/core/ArrayBufferTypedArrayOrDataView.res +4 -0
  23. package/src/core/DOM.res +1026 -0
  24. package/src/core/EventType.res +108 -0
  25. package/src/crypto/Crypto.res +11 -0
  26. package/src/crypto/SubtleCrypto.res +173 -0
  27. package/src/crypto/WebCryptoTypes.res +71 -0
  28. package/src/css-font-loading/BaseCSSFontLoading.res +24 -0
  29. package/src/css-font-loading/CssFontLoadingTypes.res +92 -0
  30. package/src/css-font-loading/FontFace.res +62 -0
  31. package/src/css-font-loading/FontFaceSet.res +38 -0
  32. package/src/cssom/CSSRuleList.res +5 -0
  33. package/src/cssom/CSSStyleDeclaration.res +1734 -0
  34. package/src/cssom/CSSStyleValue.res +17 -0
  35. package/src/cssom/MediaList.res +29 -0
  36. package/src/cssom/MediaQueryList.res +18 -0
  37. package/src/cssom/StylePropertyMap.res +56 -0
  38. package/src/cssom/StylePropertyMapReadOnly.res +22 -0
  39. package/src/cssom/StyleSheet.res +152 -0
  40. package/src/cssom/StyleSheetList.res +17 -0
  41. package/src/device/GamepadHapticActuator.res +16 -0
  42. package/src/device/GamepadTypes.res +86 -0
  43. package/src/device/Geolocation.res +31 -0
  44. package/src/device/GeolocationCoordinates.res +5 -0
  45. package/src/device/GeolocationPosition.res +5 -0
  46. package/src/device/GeolocationTypes.res +81 -0
  47. package/src/device/LockManager.res +26 -0
  48. package/src/device/ScreenOrientation.res +7 -0
  49. package/src/device/ScreenWakeLockTypes.res +26 -0
  50. package/src/device/WakeLock.res +8 -0
  51. package/src/device/WakeLockSentinel.res +7 -0
  52. package/src/device/WebLocksTypes.res +45 -0
  53. package/src/device/WebMIDI.res +7 -0
  54. package/src/device/WebMidiTypes.res +36 -0
  55. package/src/dom-nodes/AbstractRange.res +30 -0
  56. package/src/dom-nodes/Attr.res +101 -0
  57. package/src/dom-nodes/CDATASection.res +7 -0
  58. package/src/dom-nodes/CaretPosition.res +2 -0
  59. package/src/dom-nodes/CharacterData.res +199 -0
  60. package/src/dom-nodes/Comment.res +15 -0
  61. package/src/dom-nodes/DOMImplementation.res +131 -0
  62. package/src/dom-nodes/DOMTree.res +1653 -0
  63. package/src/dom-nodes/DocumentFragment.res +96 -0
  64. package/src/dom-nodes/Element.res +509 -0
  65. package/src/dom-nodes/ElementInternals.res +39 -0
  66. package/src/dom-nodes/HTML.res +11 -0
  67. package/src/dom-nodes/HTMLCollection.res +25 -0
  68. package/src/dom-nodes/NamedNodeMap.res +46 -0
  69. package/src/dom-nodes/Node.res +114 -0
  70. package/src/dom-nodes/NodeFilter.res +4 -0
  71. package/src/dom-nodes/NodeIterator.res +38 -0
  72. package/src/dom-nodes/NodeList.res +6 -0
  73. package/src/dom-nodes/ProcessingInstruction.res +15 -0
  74. package/src/dom-nodes/Range.res +156 -0
  75. package/src/dom-nodes/Selection.res +137 -0
  76. package/src/dom-nodes/ShadowRoot.res +23 -0
  77. package/src/dom-nodes/StaticRange.res +6 -0
  78. package/src/dom-nodes/Text.res +31 -0
  79. package/src/dom-nodes/TreeWalker.res +65 -0
  80. package/src/dom-platform/DOMException.res +7 -0
  81. package/src/dom-platform/DOMStringList.res +15 -0
  82. package/src/dom-platform/DOMStringMap.res +5 -0
  83. package/src/dom-platform/DOMTokenList.res +70 -0
  84. package/src/event/AbortController.res +9 -0
  85. package/src/event/AbortSignal.res +25 -0
  86. package/src/event/Event.res +76 -0
  87. package/src/event/EventTarget.res +91 -0
  88. package/src/event/ExtendableEvent.res +14 -0
  89. package/src/fetch/BodyInit.res +46 -0
  90. package/src/fetch/Fetch.res +12 -0
  91. package/src/fetch/FetchTypes.res +282 -0
  92. package/src/fetch/FormData.res +71 -0
  93. package/src/fetch/FormDataEntryValue.res +2 -0
  94. package/src/fetch/Headers.res +59 -0
  95. package/src/fetch/HeadersInit.res +16 -0
  96. package/src/fetch/Request.res +61 -0
  97. package/src/fetch/Response.res +127 -0
  98. package/src/file/BaseFileAndDirectoryEntries.res +72 -0
  99. package/src/file/Blob.res +48 -0
  100. package/src/file/File.res +15 -0
  101. package/src/file/FileAndDirectoryEntriesTypes.res +35 -0
  102. package/src/file/FileList.res +16 -0
  103. package/src/file/FileSystemDirectoryEntry.res +42 -0
  104. package/src/file/FileSystemDirectoryHandle.res +49 -0
  105. package/src/file/FileSystemDirectoryReader.res +9 -0
  106. package/src/file/FileSystemEntry.res +9 -0
  107. package/src/file/FileSystemFileHandle.res +25 -0
  108. package/src/file/FileSystemHandle.res +6 -0
  109. package/src/file/FileSystemWritableFileStream.res +65 -0
  110. package/src/file/FileTypes.res +225 -0
  111. package/src/file/ReadableStream.res +79 -0
  112. package/src/file/WritableStream.res +27 -0
  113. package/src/file/WritableStreamDefaultController.res +5 -0
  114. package/src/geometry/DOMMatrix.res +206 -0
  115. package/src/geometry/DOMMatrixReadOnly.res +140 -0
  116. package/src/geometry/DOMPoint.res +28 -0
  117. package/src/geometry/DOMPointReadOnly.res +22 -0
  118. package/src/geometry/DOMRect.res +22 -0
  119. package/src/geometry/DOMRectList.res +2 -0
  120. package/src/geometry/DOMRectReadOnly.res +19 -0
  121. package/src/html/HTMLAnchorElement.res +373 -0
  122. package/src/html/HTMLAreaElement.res +353 -0
  123. package/src/html/HTMLBRElement.res +9 -0
  124. package/src/html/HTMLBaseElement.res +20 -0
  125. package/src/html/HTMLBodyElement.res +9 -0
  126. package/src/html/HTMLButtonElement.res +98 -0
  127. package/src/html/HTMLDListElement.res +9 -0
  128. package/src/html/HTMLDataElement.res +14 -0
  129. package/src/html/HTMLDataListElement.res +14 -0
  130. package/src/html/HTMLDialogElement.res +40 -0
  131. package/src/html/HTMLDivElement.res +9 -0
  132. package/src/html/HTMLElement.res +108 -0
  133. package/src/html/HTMLEmbedElement.res +275 -0
  134. package/src/html/HTMLFieldSetElement.res +70 -0
  135. package/src/html/HTMLFormControlsCollection.res +21 -0
  136. package/src/html/HTMLFormElement.res +39 -0
  137. package/src/html/HTMLFrameSetElement.res +9 -0
  138. package/src/html/HTMLHRElement.res +9 -0
  139. package/src/html/HTMLHeadElement.res +256 -0
  140. package/src/html/HTMLHeadingElement.res +9 -0
  141. package/src/html/HTMLHtmlElement.res +9 -0
  142. package/src/html/HTMLIFrameElement.res +69 -0
  143. package/src/html/HTMLImageElement.res +349 -0
  144. package/src/html/HTMLInputElement.res +310 -0
  145. package/src/html/HTMLLIElement.res +9 -0
  146. package/src/html/HTMLLabelElement.res +25 -0
  147. package/src/html/HTMLLegendElement.res +14 -0
  148. package/src/html/HTMLLinkElement.res +69 -0
  149. package/src/html/HTMLMapElement.res +20 -0
  150. package/src/html/HTMLMenuElement.res +8 -0
  151. package/src/html/HTMLMetaElement.res +29 -0
  152. package/src/html/HTMLMeterElement.res +38 -0
  153. package/src/html/HTMLModElement.res +9 -0
  154. package/src/html/HTMLOListElement.res +24 -0
  155. package/src/html/HTMLObjectElement.res +89 -0
  156. package/src/html/HTMLOptGroupElement.res +19 -0
  157. package/src/html/HTMLOptionElement.res +49 -0
  158. package/src/html/HTMLOptionsCollection.res +35 -0
  159. package/src/html/HTMLOutputElement.res +73 -0
  160. package/src/html/HTMLParagraphElement.res +9 -0
  161. package/src/html/HTMLPictureElement.res +9 -0
  162. package/src/html/HTMLPreElement.res +9 -0
  163. package/src/html/HTMLProgressElement.res +29 -0
  164. package/src/html/HTMLQuoteElement.res +9 -0
  165. package/src/html/HTMLScriptElement.res +310 -0
  166. package/src/html/HTMLSelectElement.res +157 -0
  167. package/src/html/HTMLSlotElement.res +34 -0
  168. package/src/html/HTMLSourceElement.res +18 -0
  169. package/src/html/HTMLSpanElement.res +9 -0
  170. package/src/html/HTMLStyleElement.res +24 -0
  171. package/src/html/HTMLTableCaptionElement.res +9 -0
  172. package/src/html/HTMLTableCellElement.res +40 -0
  173. package/src/html/HTMLTableElement.res +100 -0
  174. package/src/html/HTMLTableRowElement.res +40 -0
  175. package/src/html/HTMLTableSectionElement.res +30 -0
  176. package/src/html/HTMLTemplateElement.res +31 -0
  177. package/src/html/HTMLTextAreaElement.res +177 -0
  178. package/src/html/HTMLTimeElement.res +14 -0
  179. package/src/html/HTMLTitleElement.res +15 -0
  180. package/src/html/HTMLUListElement.res +9 -0
  181. package/src/html/HTMLUnknownElement.res +9 -0
  182. package/src/media/BaseEncryptedMediaExtensions.res +97 -0
  183. package/src/media/DomHTMLMediaElement.res +206 -0
  184. package/src/media/EncryptedMediaExtensionsHTMLMediaElement.res +15 -0
  185. package/src/media/EncryptedMediaExtensionsTypes.res +43 -0
  186. package/src/media/HTMLAudioElement.res +9 -0
  187. package/src/media/HTMLTrackElement.res +14 -0
  188. package/src/media/HTMLVideoElement.res +78 -0
  189. package/src/media/MediaCapabilities.res +19 -0
  190. package/src/media/MediaCapabilitiesTypes.res +83 -0
  191. package/src/media/MediaCaptureAndStreamsTypes.res +197 -0
  192. package/src/media/MediaDeviceInfo.res +9 -0
  193. package/src/media/MediaDevices.res +40 -0
  194. package/src/media/MediaError.res +14 -0
  195. package/src/media/MediaKeySession.res +53 -0
  196. package/src/media/MediaKeyStatusMap.res +11 -0
  197. package/src/media/MediaKeySystemAccess.res +14 -0
  198. package/src/media/MediaKeys.res +35 -0
  199. package/src/media/MediaMetadata.res +10 -0
  200. package/src/media/MediaSession.res +25 -0
  201. package/src/media/MediaSessionTypes.res +85 -0
  202. package/src/media/MediaStream.res +89 -0
  203. package/src/media/MediaStreamTrack.res +51 -0
  204. package/src/media/PictureInPicture.res +7 -0
  205. package/src/media/PictureInPictureTypes.res +17 -0
  206. package/src/media/RemotePlayback.res +25 -0
  207. package/src/media/RemotePlaybackTypes.res +20 -0
  208. package/src/media/SpeechSynthesis.res +33 -0
  209. package/src/media/SpeechSynthesisUtterance.res +8 -0
  210. package/src/media/TextTrack.res +15 -0
  211. package/src/media/TextTrackCueList.res +9 -0
  212. package/src/media/TextTrackList.res +17 -0
  213. package/src/media/TimeRanges.res +29 -0
  214. package/src/media/VideoPlaybackQuality.res +18 -0
  215. package/src/media/WebSpeechTypes.res +83 -0
  216. package/src/media/WebVttTypes.res +123 -0
  217. package/src/messaging/ApplicationServerKey.res +2 -0
  218. package/src/messaging/ChannelMessagingTypes.res +12 -0
  219. package/src/messaging/CloseEvent.res +10 -0
  220. package/src/messaging/MessageEvent.res +43 -0
  221. package/src/messaging/MessagePort.res +38 -0
  222. package/src/messaging/Notification.res +46 -0
  223. package/src/messaging/NotificationTypes.res +107 -0
  224. package/src/messaging/PushEvent.res +3 -0
  225. package/src/messaging/PushManager.res +24 -0
  226. package/src/messaging/PushMessageData.res +15 -0
  227. package/src/messaging/PushSubscription.res +20 -0
  228. package/src/messaging/PushTypes.res +88 -0
  229. package/src/messaging/WebSocket.res +74 -0
  230. package/src/messaging/WebSocketsTypes.res +124 -0
  231. package/src/navigator/Clipboard.res +29 -0
  232. package/src/navigator/ClipboardItem.res +20 -0
  233. package/src/navigator/ClipboardTypes.res +31 -0
  234. package/src/navigator/CredentialManagementTypes.res +138 -0
  235. package/src/navigator/CredentialsContainer.res +33 -0
  236. package/src/navigator/Navigator.res +166 -0
  237. package/src/navigator/Permissions.res +10 -0
  238. package/src/navigator/PermissionsTypes.res +38 -0
  239. package/src/observers/IntersectionObserver.res +36 -0
  240. package/src/observers/IntersectionObserverRoot.res +23 -0
  241. package/src/observers/IntersectionObserverTypes.res +67 -0
  242. package/src/observers/MutationObserver.res +94 -0
  243. package/src/observers/ResizeObserver.res +30 -0
  244. package/src/observers/ResizeObserverTypes.res +56 -0
  245. package/src/performance/Performance.res +101 -0
  246. package/src/performance/PerformanceEntry.res +5 -0
  247. package/src/performance/PerformanceMark.res +16 -0
  248. package/src/performance/PerformanceTypes.res +86 -0
  249. package/src/storage/Cache.res +117 -0
  250. package/src/storage/CacheStorage.res +43 -0
  251. package/src/storage/CacheTypes.res +24 -0
  252. package/src/storage/IDBDatabase.res +54 -0
  253. package/src/storage/IDBFactory.res +34 -0
  254. package/src/storage/IDBIndex.res +83 -0
  255. package/src/storage/IDBObjectStore.res +183 -0
  256. package/src/storage/IDBTransaction.res +22 -0
  257. package/src/storage/IndexedDbTypes.res +213 -0
  258. package/src/storage/Storage.res +42 -0
  259. package/src/storage/StorageEvent.res +10 -0
  260. package/src/storage/StorageManager.res +24 -0
  261. package/src/storage/StorageTypes.res +11 -0
  262. package/src/storage/WebStorageTypes.res +57 -0
  263. package/src/svg/SVGElement.res +115 -0
  264. package/src/svg/SVGGraphicsElement.res +16 -0
  265. package/src/svg/SVGLength.res +9 -0
  266. package/src/ui-events/CompositionEvent.res +10 -0
  267. package/src/ui-events/DataTransfer.res +38 -0
  268. package/src/ui-events/DataTransferItem.res +21 -0
  269. package/src/ui-events/DataTransferItemList.res +34 -0
  270. package/src/ui-events/FocusEvent.res +10 -0
  271. package/src/ui-events/InputEvent.res +16 -0
  272. package/src/ui-events/KeyboardEvent.res +16 -0
  273. package/src/ui-events/MouseEvent.res +26 -0
  274. package/src/ui-events/PointerEvent.res +24 -0
  275. package/src/ui-events/Touch.res +5 -0
  276. package/src/ui-events/TouchEvent.res +10 -0
  277. package/src/ui-events/TouchList.res +5 -0
  278. package/src/ui-events/UIEvent.res +20 -0
  279. package/src/ui-events/UiEventsTypes.res +590 -0
  280. package/src/ui-events/WheelEvent.res +10 -0
  281. package/src/url/URL.res +38 -0
  282. package/src/url/URLSearchParams.res +104 -0
  283. package/src/url/UrlTypes.res +69 -0
  284. package/src/view-transitions/ViewTransition.res +5 -0
  285. package/src/view-transitions/ViewTransitionsTypes.res +22 -0
  286. package/src/web-audio/AnalyserNode.res +38 -0
  287. package/src/web-audio/AudioBuffer.res +33 -0
  288. package/src/web-audio/AudioBufferSourceNode.res +21 -0
  289. package/src/web-audio/AudioContext.res +59 -0
  290. package/src/web-audio/AudioDestinationNode.res +1 -0
  291. package/src/web-audio/AudioNode.res +76 -0
  292. package/src/web-audio/AudioParam.res +65 -0
  293. package/src/web-audio/AudioProcessingEvent.res +10 -0
  294. package/src/web-audio/AudioScheduledSourceNode.res +23 -0
  295. package/src/web-audio/AudioWorkletNode.res +11 -0
  296. package/src/web-audio/BaseAudioContext.res +141 -0
  297. package/src/web-audio/BiquadFilterNode.res +21 -0
  298. package/src/web-audio/ChannelMergerNode.res +10 -0
  299. package/src/web-audio/ChannelSplitterNode.res +10 -0
  300. package/src/web-audio/ConstantSourceNode.res +10 -0
  301. package/src/web-audio/ConvolverNode.res +10 -0
  302. package/src/web-audio/DelayNode.res +10 -0
  303. package/src/web-audio/DynamicsCompressorNode.res +10 -0
  304. package/src/web-audio/GainNode.res +10 -0
  305. package/src/web-audio/IIRFilterNode.res +21 -0
  306. package/src/web-audio/MediaElementAudioSourceNode.res +10 -0
  307. package/src/web-audio/MediaStreamAudioDestinationNode.res +10 -0
  308. package/src/web-audio/MediaStreamAudioSourceNode.res +10 -0
  309. package/src/web-audio/OfflineAudioCompletionEvent.res +10 -0
  310. package/src/web-audio/OfflineAudioContext.res +58 -0
  311. package/src/web-audio/OscillatorNode.res +17 -0
  312. package/src/web-audio/PannerNode.res +10 -0
  313. package/src/web-audio/PeriodicWave.res +8 -0
  314. package/src/web-audio/StereoPannerNode.res +10 -0
  315. package/src/web-audio/WaveShaperNode.res +10 -0
  316. package/src/web-audio/WebAudioTypes.res +1309 -0
  317. package/src/web-audio/Worklet.res +14 -0
  318. package/src/window/CustomElementRegistry.res +30 -0
  319. package/src/window/Document.res +470 -0
  320. package/src/window/DomGlobal.res +459 -0
  321. package/src/window/History.res +37 -0
  322. package/src/window/HistoryTypes.res +26 -0
  323. package/src/window/IdleDeadline.res +5 -0
  324. package/src/window/Location.res +108 -0
  325. package/src/window/VisualViewport.res +5 -0
  326. package/src/window/VisualViewportTypes.res +37 -0
  327. package/src/window/Window.res +556 -0
  328. package/src/window/XPathExpression.res +16 -0
  329. package/src/window/XPathResult.res +46 -0
  330. package/src/workers/Clients.res +39 -0
  331. package/src/workers/NavigationPreloadManager.res +26 -0
  332. package/src/workers/ServiceWorker.res +38 -0
  333. package/src/workers/ServiceWorkerContainer.res +34 -0
  334. package/src/workers/ServiceWorkerRegistration.res +32 -0
  335. package/src/workers/ServiceWorkerScope.res +12 -0
  336. package/src/workers/ServiceWorkerTypes.res +153 -0
  337. package/src/workers/SharedWorker.res +68 -0
  338. package/src/workers/SharedWorkerScope.res +29 -0
  339. package/src/workers/WebWorkersTypes.res +46 -0
  340. package/src/workers/Worker.res +48 -0
  341. package/src/workers/WorkerLocation.res +18 -0
@@ -0,0 +1,24 @@
1
+ /**
2
+ Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the Service Worker life cycle. The Cache interface is also available in window contexts.
3
+ [See Cache on MDN](https://developer.mozilla.org/docs/Web/API/Cache)
4
+ */
5
+ @editor.completeFrom(Cache)
6
+ type cache = private {}
7
+
8
+ /**
9
+ The storage for Cache objects.
10
+ [See CacheStorage on MDN](https://developer.mozilla.org/docs/Web/API/CacheStorage)
11
+ */
12
+ @editor.completeFrom(CacheStorage)
13
+ type cacheStorage = private {}
14
+
15
+ type cacheQueryOptions = {
16
+ mutable ignoreSearch?: bool,
17
+ mutable ignoreMethod?: bool,
18
+ mutable ignoreVary?: bool,
19
+ }
20
+
21
+ type multiCacheQueryOptions = {
22
+ ...cacheQueryOptions,
23
+ mutable cacheName?: string,
24
+ }
@@ -0,0 +1,54 @@
1
+ include EventTarget.Impl({type t = IndexedDbTypes.idbDatabase})
2
+
3
+ /**
4
+ Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.
5
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction)
6
+ */
7
+ @throws(JsExn) @send
8
+ external transaction: (
9
+ IndexedDbTypes.idbDatabase,
10
+ ~storeNames: string,
11
+ ~mode: IndexedDbTypes.idbTransactionMode=?,
12
+ ~options: IndexedDbTypes.idbTransactionOptions=?,
13
+ ) => IndexedDbTypes.idbTransaction = "transaction"
14
+
15
+ /**
16
+ Returns a new transaction with the given mode ("readonly" or "readwrite") and scope which can be a single object store name or an array of names.
17
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/transaction)
18
+ */
19
+ @throws(JsExn) @send
20
+ external transaction2: (
21
+ IndexedDbTypes.idbDatabase,
22
+ ~storeNames: array<string>,
23
+ ~mode: IndexedDbTypes.idbTransactionMode=?,
24
+ ~options: IndexedDbTypes.idbTransactionOptions=?,
25
+ ) => IndexedDbTypes.idbTransaction = "transaction"
26
+
27
+ /**
28
+ Closes the connection once all running transactions have finished.
29
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/close)
30
+ */
31
+ @send
32
+ external close: IndexedDbTypes.idbDatabase => unit = "close"
33
+
34
+ /**
35
+ Creates a new object store with the given name and options and returns a new IDBObjectStore.
36
+
37
+ Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
38
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/createObjectStore)
39
+ */
40
+ @throws(JsExn) @send
41
+ external createObjectStore: (
42
+ IndexedDbTypes.idbDatabase,
43
+ ~name: string,
44
+ ~options: IndexedDbTypes.idbObjectStoreParameters=?,
45
+ ) => IndexedDbTypes.idbObjectStore = "createObjectStore"
46
+
47
+ /**
48
+ Deletes the object store with the given name.
49
+
50
+ Throws a "InvalidStateError" DOMException if not called within an upgrade transaction.
51
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/deleteObjectStore)
52
+ */
53
+ @throws(JsExn) @send
54
+ external deleteObjectStore: (IndexedDbTypes.idbDatabase, string) => unit = "deleteObjectStore"
@@ -0,0 +1,34 @@
1
+ /**
2
+ Attempts to open a connection to the named database with the current version, or 1 if it does not already exist. If the request is successful request's result will be the connection.
3
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBFactory/open)
4
+ */
5
+ @throws(JsExn) @send
6
+ external open_: (
7
+ IndexedDbTypes.idbFactory,
8
+ ~name: string,
9
+ ~version: int=?,
10
+ ) => IndexedDbTypes.idbOpenDBRequest = "open"
11
+
12
+ /**
13
+ Attempts to delete the named database. If the database already exists and there are open connections that don't close in response to a versionchange event, the request will be blocked until all they close. If the request is successful request's result will be null.
14
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBFactory/deleteDatabase)
15
+ */
16
+ @send
17
+ external deleteDatabase: (IndexedDbTypes.idbFactory, string) => IndexedDbTypes.idbOpenDBRequest =
18
+ "deleteDatabase"
19
+
20
+ /**
21
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBFactory/databases)
22
+ */
23
+ @send
24
+ external databases: IndexedDbTypes.idbFactory => promise<array<IndexedDbTypes.idbDatabaseInfo>> =
25
+ "databases"
26
+
27
+ /**
28
+ Compares two values as keys. Returns -1 if key1 precedes key2, 1 if key2 precedes key1, and 0 if the keys are equal.
29
+
30
+ Throws a "DataError" DOMException if either input is not a valid key.
31
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBFactory/cmp)
32
+ */
33
+ @throws(JsExn) @send
34
+ external cmp: (IndexedDbTypes.idbFactory, ~first: JSON.t, ~second: JSON.t) => int = "cmp"
@@ -0,0 +1,83 @@
1
+ /**
2
+ Retrieves the value of the first record matching the given key or key range in query.
3
+
4
+ If successful, request's result will be the value, or undefined if there was no matching record.
5
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/get)
6
+ */
7
+ @throws(JsExn) @send
8
+ external get: (IndexedDbTypes.idbIndex, unknown) => IndexedDbTypes.idbRequest<option<JSON.t>> =
9
+ "get"
10
+
11
+ /**
12
+ Retrieves the key of the first record matching the given key or key range in query.
13
+
14
+ If successful, request's result will be the key, or undefined if there was no matching record.
15
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/getKey)
16
+ */
17
+ @throws(JsExn) @send
18
+ external getKey: (
19
+ IndexedDbTypes.idbIndex,
20
+ unknown,
21
+ ) => IndexedDbTypes.idbRequest<option<IndexedDbTypes.idbValidKey>> = "getKey"
22
+
23
+ /**
24
+ Retrieves the values of the records matching the given key or key range in query (up to count if given).
25
+
26
+ If successful, request's result will be an Array of the values.
27
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/getAll)
28
+ */
29
+ @throws(JsExn) @send
30
+ external getAll: (
31
+ IndexedDbTypes.idbIndex,
32
+ ~query: unknown=?,
33
+ ~count: int=?,
34
+ ) => IndexedDbTypes.idbRequest<array<JSON.t>> = "getAll"
35
+
36
+ /**
37
+ Retrieves the keys of records matching the given key or key range in query (up to count if given).
38
+
39
+ If successful, request's result will be an Array of the keys.
40
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/getAllKeys)
41
+ */
42
+ @throws(JsExn) @send
43
+ external getAllKeys: (
44
+ IndexedDbTypes.idbIndex,
45
+ ~query: unknown=?,
46
+ ~count: int=?,
47
+ ) => IndexedDbTypes.idbRequest<array<IndexedDbTypes.idbValidKey>> = "getAllKeys"
48
+
49
+ /**
50
+ Retrieves the number of records matching the given key or key range in query.
51
+
52
+ If successful, request's result will be the count.
53
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/count)
54
+ */
55
+ @throws(JsExn) @send
56
+ external count: (IndexedDbTypes.idbIndex, ~query: unknown=?) => IndexedDbTypes.idbRequest<int> =
57
+ "count"
58
+
59
+ /**
60
+ Opens a cursor over the records matching query, ordered by direction. If query is null, all records in index are matched.
61
+
62
+ If successful, request's result will be an IDBCursorWithValue, or null if there were no matching records.
63
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/openCursor)
64
+ */
65
+ @throws(JsExn) @send
66
+ external openCursor: (
67
+ IndexedDbTypes.idbIndex,
68
+ ~query: unknown=?,
69
+ ~direction: IndexedDbTypes.idbCursorDirection=?,
70
+ ) => IndexedDbTypes.idbRequest<Null.t<unknown>> = "openCursor"
71
+
72
+ /**
73
+ Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in index are matched.
74
+
75
+ If successful, request's result will be an IDBCursor, or null if there were no matching records.
76
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/openKeyCursor)
77
+ */
78
+ @throws(JsExn) @send
79
+ external openKeyCursor: (
80
+ IndexedDbTypes.idbIndex,
81
+ ~query: unknown=?,
82
+ ~direction: IndexedDbTypes.idbCursorDirection=?,
83
+ ) => IndexedDbTypes.idbRequest<Null.t<unknown>> = "openKeyCursor"
@@ -0,0 +1,183 @@
1
+ /**
2
+ Adds or updates a record in store with the given value and key.
3
+
4
+ If the store uses in-line keys and key is specified a "DataError" DOMException will be thrown.
5
+
6
+ If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a "ConstraintError" DOMException.
7
+
8
+ If successful, request's result will be the record's key.
9
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/put)
10
+ */
11
+ @throws(JsExn) @send
12
+ external put: (
13
+ IndexedDbTypes.idbObjectStore,
14
+ ~value: JSON.t,
15
+ ~key: IndexedDbTypes.idbValidKey=?,
16
+ ) => IndexedDbTypes.idbRequest<IndexedDbTypes.idbValidKey> = "put"
17
+
18
+ /**
19
+ Adds or updates a record in store with the given value and key.
20
+
21
+ If the store uses in-line keys and key is specified a "DataError" DOMException will be thrown.
22
+
23
+ If put() is used, any existing record with the key will be replaced. If add() is used, and if a record with the key already exists the request will fail, with request's error set to a "ConstraintError" DOMException.
24
+
25
+ If successful, request's result will be the record's key.
26
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/add)
27
+ */
28
+ @throws(JsExn) @send
29
+ external add: (
30
+ IndexedDbTypes.idbObjectStore,
31
+ ~value: JSON.t,
32
+ ~key: IndexedDbTypes.idbValidKey=?,
33
+ ) => IndexedDbTypes.idbRequest<IndexedDbTypes.idbValidKey> = "add"
34
+
35
+ /**
36
+ Deletes records in store with the given key or in the given key range in query.
37
+
38
+ If successful, request's result will be undefined.
39
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/delete)
40
+ */
41
+ @throws(JsExn) @send
42
+ external delete: (IndexedDbTypes.idbObjectStore, unknown) => IndexedDbTypes.idbRequest<unit> =
43
+ "delete"
44
+
45
+ /**
46
+ Deletes all records in store.
47
+
48
+ If successful, request's result will be undefined.
49
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/clear)
50
+ */
51
+ @throws(JsExn) @send
52
+ external clear: IndexedDbTypes.idbObjectStore => IndexedDbTypes.idbRequest<unit> = "clear"
53
+
54
+ /**
55
+ Retrieves the value of the first record matching the given key or key range in query.
56
+
57
+ If successful, request's result will be the value, or undefined if there was no matching record.
58
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/get)
59
+ */
60
+ @throws(JsExn) @send
61
+ external get: (
62
+ IndexedDbTypes.idbObjectStore,
63
+ unknown,
64
+ ) => IndexedDbTypes.idbRequest<option<JSON.t>> = "get"
65
+
66
+ /**
67
+ Retrieves the key of the first record matching the given key or key range in query.
68
+
69
+ If successful, request's result will be the key, or undefined if there was no matching record.
70
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/getKey)
71
+ */
72
+ @throws(JsExn) @send
73
+ external getKey: (
74
+ IndexedDbTypes.idbObjectStore,
75
+ unknown,
76
+ ) => IndexedDbTypes.idbRequest<option<IndexedDbTypes.idbValidKey>> = "getKey"
77
+
78
+ /**
79
+ Retrieves the values of the records matching the given key or key range in query (up to count if given).
80
+
81
+ If successful, request's result will be an Array of the values.
82
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/getAll)
83
+ */
84
+ @throws(JsExn) @send
85
+ external getAll: (
86
+ IndexedDbTypes.idbObjectStore,
87
+ ~query: unknown=?,
88
+ ~count: int=?,
89
+ ) => IndexedDbTypes.idbRequest<array<JSON.t>> = "getAll"
90
+
91
+ /**
92
+ Retrieves the keys of records matching the given key or key range in query (up to count if given).
93
+
94
+ If successful, request's result will be an Array of the keys.
95
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/getAllKeys)
96
+ */
97
+ @throws(JsExn) @send
98
+ external getAllKeys: (
99
+ IndexedDbTypes.idbObjectStore,
100
+ ~query: unknown=?,
101
+ ~count: int=?,
102
+ ) => IndexedDbTypes.idbRequest<array<IndexedDbTypes.idbValidKey>> = "getAllKeys"
103
+
104
+ /**
105
+ Retrieves the number of records matching the given key or key range in query.
106
+
107
+ If successful, request's result will be the count.
108
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/count)
109
+ */
110
+ @throws(JsExn) @send
111
+ external count: (
112
+ IndexedDbTypes.idbObjectStore,
113
+ ~query: unknown=?,
114
+ ) => IndexedDbTypes.idbRequest<int> = "count"
115
+
116
+ /**
117
+ Opens a cursor over the records matching query, ordered by direction. If query is null, all records in store are matched.
118
+
119
+ If successful, request's result will be an IDBCursorWithValue pointing at the first matching record, or null if there were no matching records.
120
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/openCursor)
121
+ */
122
+ @throws(JsExn) @send
123
+ external openCursor: (
124
+ IndexedDbTypes.idbObjectStore,
125
+ ~query: unknown=?,
126
+ ~direction: IndexedDbTypes.idbCursorDirection=?,
127
+ ) => IndexedDbTypes.idbRequest<Null.t<unknown>> = "openCursor"
128
+
129
+ /**
130
+ Opens a cursor with key only flag set over the records matching query, ordered by direction. If query is null, all records in store are matched.
131
+
132
+ If successful, request's result will be an IDBCursor pointing at the first matching record, or null if there were no matching records.
133
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/openKeyCursor)
134
+ */
135
+ @throws(JsExn) @send
136
+ external openKeyCursor: (
137
+ IndexedDbTypes.idbObjectStore,
138
+ ~query: unknown=?,
139
+ ~direction: IndexedDbTypes.idbCursorDirection=?,
140
+ ) => IndexedDbTypes.idbRequest<Null.t<unknown>> = "openKeyCursor"
141
+
142
+ /**
143
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/index)
144
+ */
145
+ @throws(JsExn) @send
146
+ external index: (IndexedDbTypes.idbObjectStore, string) => IndexedDbTypes.idbIndex = "index"
147
+
148
+ /**
149
+ Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a "ConstraintError" DOMException.
150
+
151
+ Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
152
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/createIndex)
153
+ */
154
+ @throws(JsExn) @send
155
+ external createIndex: (
156
+ IndexedDbTypes.idbObjectStore,
157
+ ~name: string,
158
+ ~keyPath: string,
159
+ ~options: IndexedDbTypes.idbIndexParameters=?,
160
+ ) => IndexedDbTypes.idbIndex = "createIndex"
161
+
162
+ /**
163
+ Creates a new index in store with the given name, keyPath and options and returns a new IDBIndex. If the keyPath and options define constraints that cannot be satisfied with the data already in store the upgrade transaction will abort with a "ConstraintError" DOMException.
164
+
165
+ Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
166
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/createIndex)
167
+ */
168
+ @throws(JsExn) @send
169
+ external createIndex2: (
170
+ IndexedDbTypes.idbObjectStore,
171
+ ~name: string,
172
+ ~keyPath: array<string>,
173
+ ~options: IndexedDbTypes.idbIndexParameters=?,
174
+ ) => IndexedDbTypes.idbIndex = "createIndex"
175
+
176
+ /**
177
+ Deletes the index in store with the given name.
178
+
179
+ Throws an "InvalidStateError" DOMException if not called within an upgrade transaction.
180
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/deleteIndex)
181
+ */
182
+ @throws(JsExn) @send
183
+ external deleteIndex: (IndexedDbTypes.idbObjectStore, string) => unit = "deleteIndex"
@@ -0,0 +1,22 @@
1
+ include EventTarget.Impl({type t = IndexedDbTypes.idbTransaction})
2
+
3
+ /**
4
+ Returns an IDBObjectStore in the transaction's scope.
5
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStore)
6
+ */
7
+ @throws(JsExn) @send
8
+ external objectStore: (IndexedDbTypes.idbTransaction, string) => IndexedDbTypes.idbObjectStore =
9
+ "objectStore"
10
+
11
+ /**
12
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/commit)
13
+ */
14
+ @throws(JsExn) @send
15
+ external commit: IndexedDbTypes.idbTransaction => unit = "commit"
16
+
17
+ /**
18
+ Aborts the transaction. All pending requests will fail with a "AbortError" DOMException and all changes made to the database will be reverted.
19
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/abort)
20
+ */
21
+ @throws(JsExn) @send
22
+ external abort: IndexedDbTypes.idbTransaction => unit = "abort"
@@ -0,0 +1,213 @@
1
+ @@warning("-30")
2
+
3
+ type idbTransactionMode =
4
+ | @as("readonly") Readonly
5
+ | @as("readwrite") Readwrite
6
+ | @as("versionchange") Versionchange
7
+
8
+ type idbTransactionDurability =
9
+ | @as("default") Default
10
+ | @as("relaxed") Relaxed
11
+ | @as("strict") Strict
12
+
13
+ type idbRequestReadyState =
14
+ | @as("done") Done
15
+ | @as("pending") Pending
16
+
17
+ type idbCursorDirection =
18
+ | @as("next") Next
19
+ | @as("nextunique") Nextunique
20
+ | @as("prev") Prev
21
+ | @as("prevunique") Prevunique
22
+
23
+ /**
24
+ In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. For a full working example, see our To-do Notifications app (view example live.)
25
+ [See IDBFactory on MDN](https://developer.mozilla.org/docs/Web/API/IDBFactory)
26
+ */
27
+ @editor.completeFrom(IDBFactory)
28
+ type idbFactory = private {}
29
+
30
+ /**
31
+ This WebApiIndexedDB API interface provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database.
32
+ [See IDBDatabase on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase)
33
+ */
34
+ @editor.completeFrom(IDBDatabase)
35
+ type idbDatabase = private {
36
+ ...DOM.eventTarget,
37
+ /**
38
+ Returns the name of the database.
39
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/name)
40
+ */
41
+ name: string,
42
+ /**
43
+ Returns the version of the database.
44
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/version)
45
+ */
46
+ version: int,
47
+ /**
48
+ Returns a list of the names of object stores in the database.
49
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBDatabase/objectStoreNames)
50
+ */
51
+ objectStoreNames: DOM.domStringList,
52
+ }
53
+
54
+ /**
55
+ [See IDBTransaction on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction)
56
+ */
57
+ @editor.completeFrom(IDBTransaction)
58
+ type idbTransaction = private {
59
+ ...DOM.eventTarget,
60
+ /**
61
+ Returns a list of the names of object stores in the transaction's scope. For an upgrade transaction this is all object stores in the database.
62
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/objectStoreNames)
63
+ */
64
+ objectStoreNames: DOM.domStringList,
65
+ /**
66
+ Returns the mode the transaction was created with ("readonly" or "readwrite"), or "versionchange" for an upgrade transaction.
67
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/mode)
68
+ */
69
+ mode: idbTransactionMode,
70
+ /**
71
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/durability)
72
+ */
73
+ durability: idbTransactionDurability,
74
+ /**
75
+ Returns the transaction's connection.
76
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/db)
77
+ */
78
+ db: idbDatabase,
79
+ /**
80
+ If the transaction was aborted, returns the error (a DOMException) providing the reason.
81
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBTransaction/error)
82
+ */
83
+ error: Null.t<DOM.domException>,
84
+ }
85
+
86
+ /**
87
+ The request object does not initially contain any information about the result of the operation, but once information becomes available, an event is fired on the request, and the information becomes available through the properties of the IDBRequest instance.
88
+ [See IDBRequest on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest)
89
+ */
90
+ type idbRequest<'t> = {
91
+ ...DOM.eventTarget,
92
+ /**
93
+ When a request is completed, returns the result, or undefined if the request failed. Throws a "InvalidStateError" DOMException if the request is still pending.
94
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest/result)
95
+ */
96
+ @throws(JsExn)
97
+ result: 't,
98
+ /**
99
+ When a request is completed, returns the error (a DOMException), or null if the request succeeded. Throws a "InvalidStateError" DOMException if the request is still pending.
100
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest/error)
101
+ */
102
+ @throws(JsExn)
103
+ error: Null.t<DOM.domException>,
104
+ /**
105
+ Returns the IDBObjectStore, IDBIndex, or IDBCursor the request was made against, or null if is was an open request.
106
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest/source)
107
+ */
108
+ source: Null.t<unknown>,
109
+ /**
110
+ Returns the IDBTransaction the request was made within. If this as an open request, then it returns an upgrade transaction while it is running, or null otherwise.
111
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest/transaction)
112
+ */
113
+ transaction: Null.t<idbTransaction>,
114
+ /**
115
+ Returns "pending" until a request is complete, then returns "done".
116
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBRequest/readyState)
117
+ */
118
+ readyState: idbRequestReadyState,
119
+ }
120
+
121
+ /**
122
+ Also inherits methods from its parents IDBRequest and EventTarget.
123
+ [See IDBOpenDBRequest on MDN](https://developer.mozilla.org/docs/Web/API/IDBOpenDBRequest)
124
+ */
125
+ type idbOpenDBRequest = {
126
+ ...idbRequest<idbDatabase>,
127
+ }
128
+
129
+ /**
130
+ This example shows a variety of different uses of object stores, from updating the data structure with IDBObjectStore.createIndex inside an onupgradeneeded function, to adding a new item to our object store with IDBObjectStore.add. For a full working example, see our To-do Notifications app (view example live.)
131
+ [See IDBObjectStore on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore)
132
+ TODO: mark as private once mutating fields of private records is allowed
133
+ */
134
+ @editor.completeFrom(IDBObjectStore)
135
+ type idbObjectStore = {
136
+ /**
137
+ Returns the name of the store.
138
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/name)
139
+ */
140
+ @throws(JsExn)
141
+ mutable name: string,
142
+ /**
143
+ Returns the key path of the store, or null if none.
144
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/keyPath)
145
+ */
146
+ keyPath: Null.t<unknown>,
147
+ /**
148
+ Returns a list of the names of indexes in the store.
149
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/indexNames)
150
+ */
151
+ indexNames: DOM.domStringList,
152
+ /**
153
+ Returns the associated transaction.
154
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/transaction)
155
+ */
156
+ transaction: idbTransaction,
157
+ /**
158
+ Returns true if the store has a key generator, and false otherwise.
159
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBObjectStore/autoIncrement)
160
+ */
161
+ autoIncrement: bool,
162
+ }
163
+
164
+ /**
165
+ IDBIndex interface of the WebApiIndexedDB API provides asynchronous access to an index in a database. An index is a kind of object store for looking up records in another object store, called the referenced object store. You use this interface to retrieve data.
166
+ [See IDBIndex on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex)
167
+ TODO: mark as private once mutating fields of private records is allowed
168
+ */
169
+ @editor.completeFrom(IDBIndex)
170
+ type idbIndex = {
171
+ /**
172
+ Returns the name of the index.
173
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/name)
174
+ */
175
+ @throws(JsExn)
176
+ mutable name: string,
177
+ /**
178
+ Returns the IDBObjectStore the index belongs to.
179
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/objectStore)
180
+ */
181
+ objectStore: idbObjectStore,
182
+ /**
183
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/keyPath)
184
+ */
185
+ keyPath: Null.t<unknown>,
186
+ /**
187
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/multiEntry)
188
+ */
189
+ multiEntry: bool,
190
+ /**
191
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/IDBIndex/unique)
192
+ */
193
+ unique: bool,
194
+ }
195
+
196
+ type idbValidKey = unknown
197
+
198
+ type idbDatabaseInfo = {
199
+ mutable name?: string,
200
+ mutable version?: int,
201
+ }
202
+
203
+ type idbTransactionOptions = {mutable durability?: idbTransactionDurability}
204
+
205
+ type idbObjectStoreParameters = {
206
+ mutable keyPath?: Nullable.t<unknown>,
207
+ mutable autoIncrement?: bool,
208
+ }
209
+
210
+ type idbIndexParameters = {
211
+ mutable unique?: bool,
212
+ mutable multiEntry?: bool,
213
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.
3
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/key)
4
+ */
5
+ @send
6
+ external key: (WebStorageTypes.storage, int) => Null.t<string> = "key"
7
+
8
+ /**
9
+ Returns the current value associated with the given key, or null if the given key does not exist.
10
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/getItem)
11
+ */
12
+ @send
13
+ external getItem: (WebStorageTypes.storage, string) => Null.t<string> = "getItem"
14
+
15
+ /**
16
+ Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
17
+
18
+ Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
19
+
20
+ Dispatches a storage event on Window objects holding an equivalent WebApiStorage object.
21
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/setItem)
22
+ */
23
+ @throws(JsExn) @send
24
+ external setItem: (WebStorageTypes.storage, ~key: string, ~value: string) => unit = "setItem"
25
+
26
+ /**
27
+ Removes the key/value pair with the given key, if a key/value pair with the given key exists.
28
+
29
+ Dispatches a storage event on Window objects holding an equivalent WebApiStorage object.
30
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/removeItem)
31
+ */
32
+ @send
33
+ external removeItem: (WebStorageTypes.storage, string) => unit = "removeItem"
34
+
35
+ /**
36
+ Removes all key/value pairs, if there are any.
37
+
38
+ Dispatches a storage event on Window objects holding an equivalent WebApiStorage object.
39
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Storage/clear)
40
+ */
41
+ @send
42
+ external clear: WebStorageTypes.storage => unit = "clear"
@@ -0,0 +1,10 @@
1
+ include Event.Impl({type t = WebStorageTypes.storageEvent})
2
+
3
+ /**
4
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/StorageEvent)
5
+ */
6
+ @new
7
+ external make: (
8
+ ~type_: string,
9
+ ~eventInitDict: WebStorageTypes.storageEventInit=?,
10
+ ) => WebStorageTypes.storageEvent = "StorageEvent"