Goonstation 13 - Modules - TypesVar Details - Proc Details

/datum/tgui_window

Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT

Vars

byondToTguiEventMapStatic list used to map in macros that will then emit execute events to the tgui window A small disclaimer though I'm no tech wiz: I don't think it's possible to map in right or middle clicks in the current state, as they're keywords rather than modifiers.

Procs

Newpublic
acquire_lockpublic
can_be_suspendedpublic
closepublic
flush_message_queueprivate
handle_cdn_assetprivate
initializepublic
is_readypublic
on_messageprivate
reinitializepublic
release_lockRelease the window lock.
send_assetpublic
send_messagepublic
send_raw_messagepublic
subscribepublic
unsubscribepublic

Var Details

byondToTguiEventMap

Static list used to map in macros that will then emit execute events to the tgui window A small disclaimer though I'm no tech wiz: I don't think it's possible to map in right or middle clicks in the current state, as they're keywords rather than modifiers.

Proc Details

New

public

Create a new tgui window.

required client /client required id string A unique window identifier.

acquire_lock

public

Acquire the window lock. Pool will not be able to provide this window to other UIs for the duration of the lock.

Can be given an optional tgui datum, which will hook its on_message callback into the message stream.

optional ui /datum/tgui

can_be_suspended

public

Checks if the window can be sanely suspended.

return bool

close

public

Close the UI.

optional can_be_suspended bool

flush_message_queue

private

Sends queued messages if the queue wasn't empty.

handle_cdn_asset

private

Parses our asset structures for the Goonstation CDN setup

return: the string to put in the html window

initialize

public

Initializes the window with a fresh page. Puts window into the "loading" state. You can begin sending messages right after initializing. Messages will be put into the queue until the window finishes loading.

optional strict_mode bool - Enables strict error handling and BSOD. optional fancy bool - If TRUE and if this is NOT a panel, will hide the window titlebar. optional assets list - List of assets to load during initialization. optional inline_html string - Custom HTML to inject. optional inline_js string - Custom JS to inject. optional inline_css string - Custom CSS to inject.

is_ready

public

Checks if the window is ready to receive data.

return bool

on_message

private

Callback for handling incoming tgui messages.

reinitialize

public

Reinitializes the panel with previous data used for initialization.

release_lock

Release the window lock.

send_asset

public

Makes an asset available to use in tgui.

required asset datum/asset

send_message

public

Sends a message to tgui window.

required type string Message type required payload list Message payload optional force bool Send regardless of the ready status.

send_raw_message

public

Sends a raw payload to tgui window.

required message string JSON+urlencoded blob to send. optional force bool Send regardless of the ready status.

subscribe

public

Subscribes the datum to consume window messages on a specified proc.

Note, that this supports only one subscriber, because code for that is simpler and therefore faster. If necessary, this can be rewritten to support multiple subscribers.

unsubscribe

public

Unsubscribes the datum. Do not forget to call this when cleaning up.