Lynx

Home > @lynx-js/genui-a2ui > defineCatalog

defineCatalog() function

Build a catalog from a list of components, [component, manifest] pairs, and/or function entries. Duplicate names within the same kind are rejected. Function entries register their impls into functionRegistry immediately, so any executeFunctionCall after defineCatalog can route to them.

Signature:

export declare function defineCatalog(inputs: readonly CatalogInput[]): Catalog;

Parameters

Parameter

Type

Description

inputs

readonly CatalogInput[]

Returns:

Catalog

Example

import { Text, Button } from '@lynx-js/genui/a2ui'; import { defineCatalog, defineFunction } from '@lynx-js/genui/a2ui'; import { required } from '@lynx-js/genui/a2ui/functions'; import textManifest from '@lynx-js/genui/a2ui/catalog/Text/catalog.json' with { type: 'json' };

const catalog = defineCatalog([ [Text, textManifest], Button, defineFunction(required), ]);

Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.