utils/app-utils
Functions
'Read the “', Functions, '” section'closeOnOutsideClick()
'Read the “', closeOnOutsideClick(), '” section'function closeOnOutsideClick(eventTarget: EventTarget, additionalCheck?: (target: Element) => boolean): void
Defined in: studiocms/packages/studiocms_devapps/src/utils/app-utils.ts:27
Attaches an event listener to the specified event target that listens for the ‘app-toggled’ event. When the ‘app-toggled’ event is triggered, it adds or removes a click event listener on the document based on the state provided in the event’s detail.
The click event listener will dispatch a ‘toggle-app’ event with state: false
if the click occurs
outside of the specified elements or does not pass the additional check.
Parameters
'Read the “', Parameters, '” section'eventTarget
'Read the “', eventTarget, '” section'EventTarget
The target to which the ‘app-toggled’ event listener is attached.
additionalCheck?
'Read the “', additionalCheck?, '” section'(target
: Element
) => boolean
An optional function that takes an Element and returns a boolean. If provided, the click event listener will not dispatch the ‘toggle-app’ event if this function returns true for the clicked target.
void
createWindowElement()
'Read the “', createWindowElement(), '” section'function createWindowElement(content: string): DevToolbarWindow
Defined in: studiocms/packages/studiocms_devapps/src/utils/app-utils.ts:7
Creates a new window element with the specified content.
Parameters
'Read the “', Parameters, '” section'string
The HTML content to be inserted into the window element.
DevToolbarWindow
The newly created window element with the specified content.