Interface: DefineRegistryOptions<C>
API / @xmachines/play-svelte / DefineRegistryOptions
Defined in: packages/play-svelte/src/define-registry.ts:92
Options for defineRegistry.
Mirrors the upstream shape but replaces the untyped
Record<string, DefineRegistryActionFn> with a catalog-typed Actions<C> map.
Type Parameters
| Type Parameter |
|---|
C extends Catalog |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
actions? | Actions<C> | Catalog-typed action handler map. Each handler receives params typed to the exact schema defined in the catalog action (or undefined if no params were provided), plus the upstream setState and state arguments. Guard against undefined before accessing params: Example actions: { login: async (params) => { if (!params) return; actor.send({ type: "auth.login", username: params.username }); }, logout: async () => actor.send({ type: "auth.logout" }), } | packages/play-svelte/src/define-registry.ts:116 |
components? | Components<C> | Svelte component implementations — keyed by catalog component name. | packages/play-svelte/src/define-registry.ts:96 |
onRenderError? | any | Callback invoked when a catalog component throws during render. The error is caught by @json-render/svelte’s inner <svelte:boundary> that wraps each rendered element. When provided, this callback replaces the default console.error(...) fallback — the component is silently removed from the DOM and your callback receives the error and the element type name for custom error reporting or recovery logic. Example const { registry, handlers } = defineRegistry(authCatalog, { components: { Login, Dashboard }, actions: { ... }, onRenderError(error, elementType) { console.warn(Component <${elementType}> crashed:, error); reportToSentry(error, { componentType: elementType }); }, }); Param The thrown value (not necessarily an Error instance). Param The catalog component name that crashed (e.g. "Dashboard"). | packages/play-svelte/src/define-registry.ts:141 |