Skip to content

Commit 8995b76

Browse files
committed
Add OffscreenCanvas bindings
1 parent f27ac59 commit 8995b76

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Webapi/Webapi__Canvas.res

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ module CanvasElement = {
1818
@get external width: Dom.element => int = "width"
1919
@set external setWidth: (Dom.element, int) => unit = "width"
2020
}
21+
22+
module OffscreenCanvas = {
23+
type t
24+
@new external make: (~width: float, ~height: float) => t = "OffscreenCanvas"
25+
26+
@send external getContext2d: (t, @as("2d") _) => Canvas2d.t = "getContext"
27+
@send external getContextWebGl: (t, @as("webgl") _) => WebGl.glT = "getContext"
28+
29+
@get external height: t => int = "height"
30+
@set external setHeight: (t, int) => unit = "height"
31+
@get external width: t => int = "width"
32+
@set external setWidth: (t, int) => unit = "width"
33+
}

0 commit comments

Comments
 (0)