Skip to content

Class Modal ​

Source: modal.ts

Represents a modal window.

Constructors ​

Constructor ​

new Modal(element: FC<ModalProps> | null, callback?: ((...args: unknown[]) => void) | null): Modal

Parameters ​

element ​

FC<ModalProps> | null

callback? ​

((...args: unknown[]) => void) | null

Returns ​

Modal

Properties ​

size ​

size: Vector2

The size of this modal.

Default ​

ts
new Vector2(400, 200)

position ​

position: Vector2

The position of this modal.

Default ​

ts
new Vector2(300, 300)

icon ​

icon: string | null = null

The icon of this modal.

Default ​

ts
null

title ​

title: string | null = null

The title of this modal.

Default ​

ts
null

modalsManager ​

modalsManager: ModalsManager | null = null

The manager that handles all modals.


element ​

element: FC<ModalProps> | null = null

The content of this modal.

Default ​

ts
null

props ​

props: object = {}


callback ​

callback: ((...args: unknown[]) => void) | null = null


id ​

id: number | null = null

The ID of this modal.


dismissible ​

dismissible: boolean = true

Whether this modal can be dismissed (e.g., by pressing ESC).

Default ​

ts
true

lastInteraction? ​

optional lastInteraction?: number

Timestamp of the most recent interaction with this modal.

Methods ​

setIcon() ​

setIcon(icon: string): Modal

Parameters ​

icon ​

string

Returns ​

Modal


setTitle() ​

setTitle(title: string): Modal

Parameters ​

title ​

string

Returns ​

Modal


setPosition() ​

setPosition(position: Vector2): Modal

Parameters ​

position ​

Vector2

Returns ​

Modal


setSize() ​

setSize(size: Vector2): Modal

Parameters ​

size ​

Vector2

Returns ​

Modal


setProps() ​

setProps(props: object): Modal

Parameters ​

props ​

object

Returns ​

Modal


setDismissible() ​

setDismissible(dismissible: boolean): Modal

Parameters ​

dismissible ​

boolean

Returns ​

Modal


focus() ​

focus(): void

Returns ​

void


finish() ​

finish(...args: unknown[]): void

Parameters ​

args ​

...unknown[]

Returns ​

void


close() ​

close(): void

Returns ​

void

Built by Prozilla