attach
export function attach(
componentName: string,
type: string,
createComponentInstance: (instance: Instance) => any
): void
Description
The attach
function attaches a component to the window
object and to the top window object (if possible). It creates a global function with a given componentName
that takes an instance
and appends the component to the body if a component with a matching type
is not already present.
Import
This function can be imported as such:
import {attach} from '@unless/component-library.utils.helpers'
Parameters
Name | Type | Description |
---|---|---|
componentName | string | The name of the component. |
type | string | The type of the component. |
createComponentInstance | (instance: Instance) => any | A function that creates an instance of the component and returns it. |
Updated 9 months ago
What’s Next