utils/app-utils
Esta página aún no está disponible en tu idioma.
Functions
Section titled “Functions”closeOnOutsideClick()
Section titled “closeOnOutsideClick()”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
Section titled “Parameters”eventTarget
Section titled “eventTarget”EventTarget
The target to which the ‘app-toggled’ event listener is attached.
additionalCheck?
Section titled “additionalCheck?”(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.
Returns
Section titled “Returns”void
createWindowElement()
Section titled “createWindowElement()”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
Section titled “Parameters”content
Section titled “content”string
The HTML content to be inserted into the window element.
Returns
Section titled “Returns”DevToolbarWindow
The newly created window element with the specified content.