Skip to content

Interface: DefineRegistryOptions<C>

API / @xmachines/play-svelte / DefineRegistryOptions

Defined in: packages/play-svelte/src/define-registry.ts:65

The options of defineRegistry.

The shape is the shape of the function above, but actions stays optional also for a catalog that declares actions.

Type Parameters

Type Parameter
C extends Catalog

Properties

PropertyTypeDescriptionDefined in
actions?Actions<C>The catalog-typed map of the action handlers. Each handler receives params with the exact schema of the catalog action, or undefined when the caller gives no params. It also receives the setState argument and the state argument of the package above. Test for undefined before you read a param: 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:89
components?Components<C>The Svelte component implementations, with the catalog component name as the key.packages/play-svelte/src/define-registry.ts:69
onRenderError?OnRenderErrorThe callback that the renderer calls for each failure that it reports. The renderer calls it with (error, name, info). info.kind names the failure: "element" for a catalog component that throws, "props" or "visible" for an expression of a child that fails, "action" or "watch" for a chain that fails, and "root" for a failure of the root. name is the element type, or the action name of a chain. With this callback, the [json-render] console line does not appear. A handler with the two parameters (error, name) stays valid. Example const { registry, handlers } = defineRegistry(authCatalog, { components: { Login, Dashboard }, actions: { ... }, onRenderError(error, name, info) { reportToSentry(error, { name, kind: info.kind, key: info.key }); }, });packages/play-svelte/src/define-registry.ts:111