My Projects
💫 Comet
API
View

View API

mount()

Mount a ui element to the viewport.

Type
mount<T extends GuiBase>(element: T, createCopy?: boolean): T

You can mount any ui framwork you'd like with a story-like api.

Usage
this.window.mount((root) => {
    const unmount = createReactTree(root);
    return () => unmount()
}))

onClose() & onOpen()

Bind a callback to be invoked when the view is opened or closed.

Type
this.onClose(cb: () => void): void
this.onOpen(cb: () => void): void

setVisible()

Set the visibility of the window.

Type
this.setVisible(state: boolean): void

linkButton()

Link a button to the view, allowing the view to be toggled by the button.

Type
this.linkButton(button: Button): void

getViewportSize()

Returns the viewport size, but only will only function as expected in viewport mode.

Type
this.getViewportSize(): Vector2