@grida/canvas-wasm 0.0.2 → 0.0.4

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.
package/README.md CHANGED
@@ -12,23 +12,16 @@ pnpm install @grida/canvas-wasm
12
12
  import init from "@grida/canvas-wasm";
13
13
 
14
14
  const factory = await init({
15
- // locate the wasm binary file
15
+ // locate the wasm binary file (location may vary by version)
16
+ // e.g. this will resolve to https://unpkg.com/@grida/canvas-wasm@0.0.2/dist/grida_canvas_wasm.wasm
16
17
  locateFile: (path) =>
17
- `https://unpkg.com/@grida/canvas-wasm@<VERSION>/bin/${path}`,
18
+ `https://unpkg.com/@grida/canvas-wasm@<VERSION>/${path}`,
18
19
  });
19
20
 
20
21
  // your canvas element
21
- const canvas = document.querySelector("#canvas");
22
- const context = canvas.getContext("webgl2", {
23
- antialias: true,
24
- depth: true,
25
- stencil: true,
26
- alpha: true,
27
- });
28
-
29
- const scene = factory.createSurface(context, 100, 100);
22
+ const canvas = document.getElementById("canvas") as HTMLCanvasElement;
23
+ const scene = factory.createWebGLCanvasSurface(canvas);
30
24
 
31
25
  // ready to draw
32
- scene.createRectangleNode();
33
- scene.redraw();
26
+ scene.loadDummyScene();
34
27
  ```