Appearance
Function: createSkillMountRoot()
ts
function createSkillMountRoot(options: {
identifier: string;
onDestroy: (reactMountRoot: HTMLElement) => any;
}): HTMLDivElement;Defined in: src/assistant-api-utils/createSkillMountRoot.ts:80
Create a mount root element for rendering skill UI. Use Shadow DOM in production and regular DOM in test mode.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | { identifier: string; onDestroy: (reactMountRoot: HTMLElement) => any; } | Configuration with an identifier string and an onDestroy callback. |
options.identifier | string | - |
options.onDestroy | (reactMountRoot: HTMLElement) => any | - |
Returns
HTMLDivElement
The React mount root element.
Example
ts
const root = createSkillMountRoot({
identifier: 'invoice-processor',
onDestroy: (el) => console.log('Skill unmounted'),
});