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

NameTypeDescription
componentNamestringThe name of the component.
typestringThe type of the component.
createComponentInstance(instance: Instance) => anyA function that creates an instance of the component and returns it.

What’s Next