Goonstation 13 - Modules - TypesProc Details

/datum/tgui_window

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

Procs

Newpublic
acquire_lockpublic
can_be_suspendedpublic
closepublic
flush_message_queueprivate
handle_cdn_assetprivate
initializepublic
is_readypublic
on_messageprivate
release_lockRelease the window lock.
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 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 inline_assets list List of assets to inline into the html.

is_ready

public

Checks if the window is ready to receive data.

return bool

on_message

private

Callback for handling incoming tgui messages.

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.