Prismalpha.8
Reference

API

Supported public API exported from the package root.

Import Prism from the package root:

import { CanvasRuntime } from "@synthesisengineering/prism";

Everything outside the package root is not public API. Runtime internals, backend classes, and raw HTML-in-Canvas wrappers are internal.

Public exports

  • CanvasRuntime
  • type CanvasSurface
  • type CanvasBackendKind
  • type CanvasBackendPreference
  • type CanvasRuntimeOptions
  • type SurfaceOptions
  • type SurfaceBoundsInput
  • type PaintHandler
  • type UpdateHandler
  • type CanvasPoint

CanvasRuntime is the only constructible public runtime class.

CanvasSurface is a public TypeScript type. Surface instances are returned by registerSurface() and should not be constructed by apps.

Runtime semantics

  • onPaint() and onUpdate() are additive. They register another handler and do not replace existing handlers.
  • invalidate() schedules another Prism-owned paint pass; it does not store app state.
  • Registering the same element with the same runtime returns the existing CanvasSurface; new options are not reapplied.
  • paintOnce() works without start(). Pending paintOnce() waiters reject if a paint handler throws or the runtime is destroyed.
  • destroy() disposes registered surfaces. Disposed surfaces report isDisposed === true; getBounds() and setBounds() throw.
  • Prism does not expose a general event system or unsubscribe API today.