Skip to content

Commit

Permalink
Update bindings for offscreenCanvas getContext
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Nov 14, 2024
1 parent d86214d commit 6660e1d
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions src/CanvasAPI/OffscreenCanvas.res
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ 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: (
external getContext_2D: (
offscreenCanvas,
~contextId: offscreenRenderingContextId,
@as("2d") _,
~options: JSON.t=?,
) => offscreenCanvasRenderingContext2D = "getContext"

Expand All @@ -113,11 +113,11 @@ 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 getContext2: (
external getContext_WebGL: (
offscreenCanvas,
~contextId: offscreenRenderingContextId,
~options: JSON.t=?,
) => imageBitmapRenderingContext = "getContext"
@as("webgl") _,
~options: webGLContextAttributes=?,
) => webGLRenderingContext = "getContext"

/**
Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API.
Expand All @@ -128,11 +128,11 @@ 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 getContext3: (
external getContext_WebGL2: (
offscreenCanvas,
~contextId: offscreenRenderingContextId,
~options: JSON.t=?,
) => webGLRenderingContext = "getContext"
@as("webgl2") _,
~options: webGLContextAttributes=?,
) => webGL2RenderingContext = "getContext"

/**
Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API.
Expand All @@ -143,11 +143,11 @@ 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 getContext4: (
external getContext_BitmapRenderer: (
offscreenCanvas,
~contextId: offscreenRenderingContextId,
~options: JSON.t=?,
) => webGL2RenderingContext = "getContext"
@as("bitmaprenderer") _,
~options: imageBitmapRenderingContextSettings=?,
) => imageBitmapRenderingContext = "getContext"

/**
Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image.
Expand Down

0 comments on commit 6660e1d

Please sign in to comment.