Skip to main content

neon_crisp / Modules / utils/guiPopupManager / PopupChild

Class: PopupChild

utils/guiPopupManager.PopupChild

The PopupChild class manages a popup child that communicates with its parent. It handles animations for opening and closing the popup, including various styles (zoom, fade, or instant), and manages input focus as needed.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new PopupChild(rootNode, firstChild, speed?, handleFocus?): PopupChild

Creates a new PopupChild instance.

Parameters

NameTypeDefault valueDescription
rootNodenodeundefinedThe root node of the popup.
firstChildnodeundefinedThe first child node of the popup.
speed?number1The speed of the animations.
handleFocus?booleantrueSpecifies whether input focus should be handled automatically.

Returns

PopupChild

Defined in

utils/guiPopupManager.ts:123

Properties

firstChild

firstChild: NodeWithData

Defined in

utils/guiPopupManager.ts:111


handleFocus

handleFocus: boolean

Defined in

utils/guiPopupManager.ts:114


openAndCloseCB

Optional openAndCloseCB: (opening: boolean, message?: Record<string, any>) => void

Type declaration

▸ (opening, message?): void

Parameters
NameType
openingboolean
message?Record<string, any>
Returns

void

Defined in

utils/guiPopupManager.ts:109


openStyle

openStyle: OpenStyle = "instant"

Defined in

utils/guiPopupManager.ts:113


parentUrl

parentUrl: url

Defined in

utils/guiPopupManager.ts:108


rootNode

rootNode: NodeWithData

Defined in

utils/guiPopupManager.ts:110


speed

speed: number

Defined in

utils/guiPopupManager.ts:112

Methods

animate

animate(node, show, openStyle?): void

Parameters

NameType
nodeNodeWithData
showboolean
openStyleOpenStyle

Returns

void

Defined in

utils/guiPopupManager.ts:155


close

close(message?): void

Closes the popup, releases input focus, and sends a close message to the parent. The popup nodes are hidden using a fade-out animation.

Parameters

NameTypeDescription
message?Record<string, any>The optional message data to send when closing the popup.

Returns

void

Defined in

utils/guiPopupManager.ts:237


on_message

on_message(message_id, message, sender): void

Handles incoming messages from the child. Closes the popup if a 'close' message is received.

Parameters

NameTypeDescription
message_idhashThe identifier of the received message.
messageRecord<string, any>The message data.
senderurlThe URL of the sender.

Returns

void

Example

this.popupManager = new PopupParent("/popup#popup")
export function on_message(this: props, message_id: hash, message: Record<string, any>, sender: url): void {
this.popupManager.on_message(message_id, message, sender)
}

Defined in

utils/guiPopupManager.ts:207


open

open(message, sender): void

Parameters

NameType
messageRecord<string, any>
senderurl

Returns

void

Defined in

utils/guiPopupManager.ts:219


setOpenAndCloseCB

setOpenAndCloseCB(cb): void

Sets the callback function to be triggered when the popup is opened or closed.

Parameters

NameTypeDescription
cb(opening: boolean, message?: Record<string, any>) => voidThe callback function to be invoked.

Returns

void

Defined in

utils/guiPopupManager.ts:151