pibblSync
import { Rectangle } from "@pibbl/core";import { pibblSync } from "@pibbl/core/sync";
const controller = pibblSync( document.querySelector("canvas")!, <Rectangle style={{ width: 160, height: 80, fill: "#2563eb" }} />,);// Later: controller.dispose();The root is a PibblNode, configuration uses PibblConfig, and the return value is PibblController.
pibblSync(canvas, root, config?): PibblController synchronously prepares the
embedded version of the same generated layout binary and mounts or updates the
canvas. It does not fetch or wait for a Promise. Use this separate entry for
intentionally synchronous or offline hosts. The root package does not re-export
this operation or include its embedded bytes in asynchronous-only bundles.
If prepareLayoutEngine or an earlier pibbl call has prepared the compatible module, synchronous mounting reuses it without decoding or compiling again. Compiled code is shared; mutable layout instances and memory remain owned by their respective mounts.
Initialization and mount failures throw synchronously. An already aborted caller
throws AbortError. New same-canvas requests supersede older pending requests;
existing live mounts retain their stable controller and originally captured
surface/lifetime configuration. Disposing the live mount invalidates a pending
update so it cannot resurrect the released mount. Importing the sync entry alone
performs no decoding, compilation, instantiation or scheduling.
API details from source
Section titled “API details from source”
Mounts or updates synchronously using the embedded layout WASM binary. Import from
pibblSync: (canvas: HTMLCanvasElement, element: PibblNode, config?: PibblConfig) => PibblControllerRelated API: pibblSync, PibblNode, PibblConfig, PibblController.
Parameters
Section titled “Parameters”-
canvas— The HTML Canvas owned by the mount. -
element— The branded recursive root descriptor. See PibblNode. -
config— Surface and lifetime options. See PibblConfig.
Returns
Section titled “Returns”The stable PibblController, synchronously.
Throws
Section titled “Throws”Throws on compilation/mount failure, or AbortError for a pre-aborted signal. Supersedes pending asynchronous requests for this Canvas.
See also
Section titled “See also”View source — packages/core/src/sync.ts:20
Implementation guidance for agents
Section titled “Implementation guidance for agents”Read the Authoring, signals, and lifecycle companion for ownership, adaptation, failure modes, and verification. Agent start provides the version-selection workflow.
Complete minimal examples
Section titled “Complete minimal examples”- Automatic JSX runtime: The production compiler emits jsx and jsxs calls for component values and fragments. Plain source
Documentation version
Section titled “Documentation version”Documentation built with @pibbl/core 0.0.2, revision a1dcf8e. ALPHA — NOT FOR PRODUCTION USE.