Space Station 13 - Modules - TypesProc Details

tgui_window

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

Procs

Newpublic
acquire_lockpublic
can_be_suspendedpublic
closepublic
flush_message_queueprivate
initializepublic
is_readypublic
on_messageprivate
reinitializepublic
release_lockpublic
replace_htmlpublic
send_assetpublic
send_messagepublic
send_raw_messagepublic
subscribepublic
unsubscribepublic

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 be automatically subscribed to incoming messages via the on_message proc.

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.

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

public

Release the window lock.

replace_html

public

Replaces the inline HTML content.

required inline_html string HTML to inject

send_asset

public

Makes an asset available to use in tgui.

required asset datum/asset

return bool - TRUE if any assets had to be sent to the client

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.