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
| Name | Type | Default value | Description |
|---|---|---|---|
rootNode | node | undefined | The root node of the popup. |
firstChild | node | undefined | The first child node of the popup. |
speed? | number | 1 | The speed of the animations. |
handleFocus? | boolean | true | Specifies whether input focus should be handled automatically. |
Returns
Defined in
Properties
firstChild
• firstChild: NodeWithData
Defined in
handleFocus
• handleFocus: boolean
Defined in
openAndCloseCB
• Optional openAndCloseCB: (opening: boolean, message?: Record<string, any>) => void
Type declaration
▸ (opening, message?): void
Parameters
| Name | Type |
|---|---|
opening | boolean |
message? | Record<string, any> |
Returns
void
Defined in
openStyle
• openStyle: OpenStyle = "instant"
Defined in
parentUrl
• parentUrl: url
Defined in
rootNode
• rootNode: NodeWithData
Defined in
speed
• speed: number
Defined in
Methods
animate
▸ animate(node, show, openStyle?): void
Parameters
| Name | Type |
|---|---|
node | NodeWithData |
show | boolean |
openStyle | OpenStyle |
Returns
void
Defined in
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
| Name | Type | Description |
|---|---|---|
message? | Record<string, any> | The optional message data to send when closing the popup. |
Returns
void
Defined in
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
| Name | Type | Description |
|---|---|---|
message_id | hash | The identifier of the received message. |
message | Record<string, any> | The message data. |
sender | url | The 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
open
▸ open(message, sender): void
Parameters
| Name | Type |
|---|---|
message | Record<string, any> |
sender | url |
Returns
void
Defined in
setOpenAndCloseCB
▸ setOpenAndCloseCB(cb): void
Sets the callback function to be triggered when the popup is opened or closed.
Parameters
| Name | Type | Description |
|---|---|---|
cb | (opening: boolean, message?: Record<string, any>) => void | The callback function to be invoked. |
Returns
void