Skip to content

Function: createRenderer()

API / @xmachines/play-dom / createRenderer

function createRenderer<C>(catalog, componentMap): (actor, container, options?) => () => void;

Defined in: packages/play-dom/src/create-renderer.ts:84

Create a reusable DOM renderer factory from a catalog and component map.

Returns a mount(actor, container, options?) function that wires up the PlayRenderer in one call and returns a disconnect cleanup function.

Type Parameters

Type Parameter
C extends Catalog<SchemaDefinition<SchemaType<string, unknown>, SchemaType<string, unknown>>, unknown>

Parameters

ParameterTypeDescription
catalogCThe json-render Catalog describing component and action schemas.
componentMapComponentRegistry<C>Component implementations keyed by catalog component name.

Returns

A mount function that accepts (actor, container, options?) and returns disconnect.

(actor, container, options?) => () => void

Remarks

createRenderer manages registryResult internally — it calls defineRegistry once and reuses the result across all mount() calls. The mount options type therefore excludes registryResult (it is always provided by createRenderer itself and cannot be overridden).

If you need to call registryResult.executeAction() programmatically (outside the emit/on flow), or pass additional provider options (navigate, onRenderError, functions, etc.), use createPlayUI (which accepts the full CreatePlayUIOptions) or defineRegistry with PlayRenderer directly rather than createRenderer.