Skip to content

Commit befbfdf

Browse files
committed
Update bindings for offscreenCanvas getContext
1 parent a72a1a4 commit befbfdf

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/CanvasAPI/OffscreenCanvas.res

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ Returns null if the canvas has already been initialized with another context typ
9898
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
9999
*/
100100
@send
101-
external getContext: (
101+
external getContext_2D: (
102102
offscreenCanvas,
103-
~contextId: offscreenRenderingContextId,
103+
@as("2d") _,
104104
~options: JSON.t=?,
105105
) => offscreenCanvasRenderingContext2D = "getContext"
106106

@@ -113,11 +113,11 @@ Returns null if the canvas has already been initialized with another context typ
113113
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
114114
*/
115115
@send
116-
external getContext2: (
116+
external getContext_WebGL: (
117117
offscreenCanvas,
118-
~contextId: offscreenRenderingContextId,
119-
~options: JSON.t=?,
120-
) => imageBitmapRenderingContext = "getContext"
118+
@as("webgl") _,
119+
~options: webGLContextAttributes=?,
120+
) => webGLRenderingContext = "getContext"
121121

122122
/**
123123
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.
@@ -128,11 +128,11 @@ Returns null if the canvas has already been initialized with another context typ
128128
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
129129
*/
130130
@send
131-
external getContext3: (
131+
external getContext_WebGL2: (
132132
offscreenCanvas,
133-
~contextId: offscreenRenderingContextId,
134-
~options: JSON.t=?,
135-
) => webGLRenderingContext = "getContext"
133+
@as("webgl2") _,
134+
~options: webGLContextAttributes=?,
135+
) => webGL2RenderingContext = "getContext"
136136

137137
/**
138138
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.
@@ -143,11 +143,11 @@ Returns null if the canvas has already been initialized with another context typ
143143
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/OffscreenCanvas/getContext)
144144
*/
145145
@send
146-
external getContext4: (
146+
external getContext_BitmapRenderer: (
147147
offscreenCanvas,
148-
~contextId: offscreenRenderingContextId,
149-
~options: JSON.t=?,
150-
) => webGL2RenderingContext = "getContext"
148+
@as("bitmaprenderer") _,
149+
~options: imageBitmapRenderingContextSettings=?,
150+
) => imageBitmapRenderingContext = "getContext"
151151

152152
/**
153153
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.

0 commit comments

Comments
 (0)