Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/CanvasAPI/OffscreenCanvas.res
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Returns null if the canvas has already been initialized with another context typ
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
*/
@send
external getContext_2D: (
external getContext2D: (
offscreenCanvas,
@as("2d") _,
~options: JSON.t=?,
Expand All @@ -33,7 +33,7 @@ Returns null if the canvas has already been initialized with another context typ
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
*/
@send
external getContext_WebGL: (
external getContextWebGL: (
offscreenCanvas,
@as("webgl") _,
~options: webGLContextAttributes=?,
Expand All @@ -48,7 +48,7 @@ Returns null if the canvas has already been initialized with another context typ
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
*/
@send
external getContext_WebGL2: (
external getContextWebGL2: (
offscreenCanvas,
@as("webgl2") _,
~options: webGLContextAttributes=?,
Expand All @@ -63,7 +63,7 @@ Returns null if the canvas has already been initialized with another context typ
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
*/
@send
external getContext_BitmapRenderer: (
external getContextBitmapRenderer: (
offscreenCanvas,
@as("bitmaprenderer") _,
~options: imageBitmapRenderingContextSettings=?,
Expand Down
2 changes: 1 addition & 1 deletion src/DOMAPI/Element.res
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ element->Element.scrollIntoView_alignToTop()
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView)
*/
@send
external scrollIntoView_alignToTop: (T.t, @as(json`true`) _) => unit = "scrollIntoView"
external scrollIntoViewAlignToTop: (T.t, @as(json`true`) _) => unit = "scrollIntoView"

/**
`scrollIntoView({ behavior: "smooth" })`
Expand Down
11 changes: 11 additions & 0 deletions src/DOMAPI/FileList.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ open FileAPI
open DOMAPI

/**
Returns the `File` at the specified index.

`FileList` is not an array, so you need to iterate manually using `length` and `item`:

```rescript
let files = []
for i in 0 to fileList.length - 1 {
files->Array.push(fileList->FileList.item(i))
}
```

[Read more on MDN](https://developer.mozilla.org/docs/Web/API/FileList/item)
*/
@send
Expand Down
8 changes: 4 additions & 4 deletions src/DOMAPI/HTMLCanvasElement.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Creates a CanvasRenderingContext2D object representing a two-dimensional renderi
[Read more on MDN](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext#2d)
*/
@send
external getContext_2D: (
external getContext2D: (
htmlCanvasElement,
@as("2d") _,
~options: canvasRenderingContext2DSettings=?,
Expand All @@ -23,7 +23,7 @@ Returns an object that provides methods and properties for drawing and manipulat
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/getContext)
*/
@send
external getContext_WebGL: (
external getContextWebGL: (
htmlCanvasElement,
@as("webgl") _,
~options: webGLContextAttributes=?,
Expand All @@ -35,7 +35,7 @@ Returns an object that provides methods and properties for drawing and manipulat
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/getContext)
*/
@send
external getContext_WebGL2: (
external getContextWebGL2: (
htmlCanvasElement,
@as("webgl2") _,
~options: webGLContextAttributes=?,
Expand All @@ -47,7 +47,7 @@ Returns an object that provides methods and properties for drawing and manipulat
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement/getContext)
*/
@send
external getContext_BitmapRenderer: (
external getContextBitmapRenderer: (
htmlCanvasElement,
@as("bitmaprenderer") _,
~options: imageBitmapRenderingContextSettings=?,
Expand Down
2 changes: 2 additions & 0 deletions src/EventAPI.res
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
@unboxed
type eventType =
| @as("abort") Abort
| @as("activate") Activate
| @as("auxclick") Auxclick
| @as("beforeinput") Beforeinput
| @as("beforetoggle") Beforetoggle
Expand Down Expand Up @@ -35,6 +36,7 @@ type eventType =
| @as("focus") Focus
| @as("formdata") Formdata
| @as("input") Input
| @as("install") Install
| @as("invalid") Invalid
| @as("keydown") Keydown
| @as("keypress") Keypress
Expand Down
2 changes: 1 addition & 1 deletion src/EventAPI/EventTarget.res
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Removes the event listener in target's event listener list with the same type, c
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
@send
external removeEventListener_useCapture: (
external removeEventListenerUseCapture: (
T.t,
eventType,
eventListener<'event>,
Expand Down
2 changes: 1 addition & 1 deletion src/Global.res
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ external removeEventListener: (
Removes the event listener in target's event listener list with the same type, callback, and options.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
*/
external removeEventListener_useCapture: (
external removeEventListenerUseCapture: (
eventType,
eventListener<'event>,
@as(json`true`) _,
Expand Down
32 changes: 31 additions & 1 deletion src/ServiceWorkerAPI/Clients.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
open ServiceWorkerAPI

type clientQueryOptions = {
mutable includeUncontrolled?: bool,
@as("type") mutable type_?: string,
}

/**
Returns a `Promise` for a `Client` matching a given id.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clients/get)
*/
@send
external get: (clients, string) => promise<Nullable.t<client>> = "get"

/**
Returns a `Promise` for an array of `Client` objects matching the given options.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clients/matchAll)
*/
@send
external matchAll: (clients, ~options: clientQueryOptions=?) => promise<array<client>> = "matchAll"

/**
Opens a new browser window for a given URL and returns a `Promise` for the new `WindowClient`.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clients/openWindow)
*/
@send
external openWindow: (clients, string) => promise<windowClient> = "openWindow"

/**
Allows an active service worker to set itself as the controller for all clients within its scope.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/Clients/claim)
*/
@send
external openWindow: (clients, string) => promise<windowClient> = "open"
external claim: clients => promise<unit> = "claim"
7 changes: 7 additions & 0 deletions src/ServiceWorkerAPI/ServiceWorkerGlobalScope.res
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
open ServiceWorkerAPI

include WorkerGlobalScope.Impl({type t = serviceWorkerGlobalScope})

/**
Forces the waiting service worker to become the active service worker.
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/ServiceWorkerGlobalScope/skipWaiting)
*/
@send
external skipWaiting: serviceWorkerGlobalScope => promise<unit> = "skipWaiting"
2 changes: 1 addition & 1 deletion tests/DOMAPI/HTMLCanvasElement__test.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ open WebAPI.Global

let myCanvas: DOMAPI.htmlCanvasElement =
document->Document.getElementById("myCanvas")->Prelude.unsafeConversation
let ctx = myCanvas->HTMLCanvasElement.getContext_2D
let ctx = myCanvas->HTMLCanvasElement.getContext2D

ctx.fillStyle = FillStyle.fromString("red")
ctx->CanvasRenderingContext2D.fillRect(~x=50., ~y=50., ~w=200., ~h=200.)
Expand Down
2 changes: 1 addition & 1 deletion tests/ServiceWorkerAPI/ServiceWorker__test.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.