/datum/tgui_window
Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT
Procs | |
New | public |
---|---|
acquire_lock | public |
can_be_suspended | public |
close | public |
flush_message_queue | private |
initialize | public |
is_ready | public |
on_message | private |
release_lock | public |
send_asset | public |
send_message | public |
send_raw_message | public |
subscribe | public |
unsubscribe | public |
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 inline_assets list List of assets to inline into the html. optional inline_html string Custom HTML to inject. optional fancy bool If TRUE, will hide the window titlebar.
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
public
Release the window lock.
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.