Skip to content

Function: defineRegistry()

API / @xmachines/play-solid / defineRegistry

function defineRegistry<C>(_catalog, options): DefineRegistryResult;

Defined in: @json-render/solid

Create a registry from a catalog with components and/or actions.

When the catalog declares actions, the actions field is required.

Type Parameters

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

Parameters

ParameterType
_catalogC
optionsDefineRegistryOptions<C>

Returns

DefineRegistryResult

Example

// Components only (catalog has no actions)
const { registry } = defineRegistry(catalog, {
components: {
Card: (ctx) => (
<div class="card">{ctx.props.title}{ctx.children}</div>
),
},
});
// Both (catalog declares actions)
const { registry, handlers, executeAction } = defineRegistry(catalog, {
components: { ... },
actions: { ... },
});