Prepare layout before mounting
Warm the shared layout module before creating an asynchronous canvas mount.
APIs demonstrated
Section titled “APIs demonstrated”- prepareLayoutEngine from
@pibbl/core
Complete example
Section titled “Complete example”Plain source. Run as a browser module after the document body exists. TSX uses jsx: "react-jsx" and jsxImportSource: "@pibbl/core".
import { Rectangle, pibbl, prepareLayoutEngine } from "@pibbl/core";
await prepareLayoutEngine();const canvas = document.createElement("canvas");canvas.width = 240;canvas.height = 100;document.body.append(canvas);const controller = await pibbl( canvas, <Rectangle style={{ left: 20, top: 20, width: 200, height: 60, fill: "#087e8b" }} />,);window.addEventListener("pagehide", () => controller.dispose(), { once: true });Usage notes
Section titled “Usage notes”- Uses the normal awaited mount after preparation.
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision a1dcf8e. ALPHA — NOT FOR PRODUCTION USE.