Lynx

genui / a2ui / defineCatalog

defineCatalog()

function defineCatalog(inputs: readonly CatalogInput[]): Catalog

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.

参数

范围类型
inputsreadonly CatalogInput[]

返回

Catalog

示例

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),
]);

定义于

@lynx-js/genui/a2ui/src/catalog/defineCatalog.ts:214

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。