Skip to content

Type Alias: MountFn

API / @xmachines/play-dom / MountFn

type MountFn = (actor, container, options?) => () => void;

Defined in: packages/play-dom/src/create-play-ui.ts:82

The mount function that createPlayUI returns.

Call it with (actor, container, mountOptions?) to start the renderer. It returns a disconnect cleanup function. That function stops the render and clears the container.

The return is a plain function. A caller runs it, or it publishes the release with asDisposable of @xmachines/core/utils, and a scope releases it:

const mount = createPlayUI(registryResult);
{
using stop = asDisposable(mount(actor, container));
// stop() runs at the end of the scope, and after an exception too
}

Parameters

ParameterType
actorViewActor
containerHTMLElement
options?MountOptions

Returns

() => void