nanoui
NANO UI FRAMEWORK
nanoui class (or whatever Byond calls classes)
nanoui is used to open and update nano browser uis
Procs | |
New | Create a new nanoui instance. |
---|---|
Process | This Process proc is called by SSnano. Use try_update() to make manual updates. |
Topic | This Topic() proc is called whenever a user clicks on a link within a Nano UI If the UI status is currently STATUS_INTERACTIVE then call the src_object Topic() If the src_object Topic() returns 1 (true) then update all UIs attached to src_object |
add_common_assets | Use this proc to add assets which are common to (and required by) all nano uis |
add_script | Add a JavsScript script to this UI These must be added before the UI has been opened, adding after that will have no effect |
add_stylesheet | Add a CSS stylesheet to this UI These must be added before the UI has been opened, adding after that will have no effect |
add_template | Add a template for this UI Templates are combined with the data sent to the UI to create the rendered view These must be added before the UI has been opened, adding after that will have no effect |
close | Close this UI |
get_config_data | Get config data to sent to the ui. |
get_html | Return the HTML for this UI |
get_send_data | Get data to sent to the ui. |
on_close_winset | Set the UI window to call the nanoclose verb when the window is closed This allows Nano to handle closed windows |
open | Open this UI |
push_data | Push data to an already open UI window |
reinitialise | Reinitialise this UI, potentially with a different template and/or initial data |
set_auto_update | Set the ui to auto update (every master_controller tick) |
set_auto_update_content | Set the ui to update the main content (re-render it) on each update |
set_auto_update_layout | Set the ui to update the layout (re-render it) on each update, turning this on will break the map ui (if it's being used) |
set_initial_data | Set the initial data for the ui. This is vital as the data structure set here cannot be changed when pushing new updates. |
set_layout_key | Set the layout key for use in the frontend Javascript The layout key is the basic layout key for the page Two files are loaded on the client based on the layout key varable: -> a template in /nano/templates with the filename "layout_<layout_key>.tmpl -> a CSS stylesheet in /nano/css with the filename "layout_<layout_key>.css |
set_map_z_level | Toggle showing the map ui |
set_show_map | Toggle showing the map ui |
set_state_key | Set the state key for use in the frontend Javascript |
set_status | Set the current status (also known as visibility) of this ui. |
set_window_options | Set the browser window options for this ui |
try_update | Process this UI, updating the entire UI or just the status (aka visibility) |
update | Update the UI |
update_status | Update the status (visibility) of this ui based on the user's status |
use_on_close_logic | Set whether or not to use the "old" on close logic (mainly unset_machine()) |
Proc Details
New
Create a new nanoui instance.
@param nuser /mob The mob who has opened/owns this ui @param nsrc_object /obj|/mob The obj or mob which this ui belongs to @param nui_key string A string key to use for this ui. Allows for multiple unique uis on one src_oject @param ntemplate string The filename of the template file from /nano/templates (e.g. "my_template.tmpl") @param ntitle string The title of this ui @param nwidth int the width of the ui window @param nheight int the height of the ui window @param nref /atom A custom ref to use if "on_close_logic" is set to 1
@return /nanoui new nanoui object
Process
This Process proc is called by SSnano. Use try_update() to make manual updates.
Topic
This Topic() proc is called whenever a user clicks on a link within a Nano UI If the UI status is currently STATUS_INTERACTIVE then call the src_object Topic() If the src_object Topic() returns 1 (true) then update all UIs attached to src_object
@return nothing
add_common_assets
Use this proc to add assets which are common to (and required by) all nano uis
@return nothing
add_script
Add a JavsScript script to this UI These must be added before the UI has been opened, adding after that will have no effect
@param file string The name of the JavaScript file from /nano/js (e.g. "my_script.js")
@return nothing
add_stylesheet
Add a CSS stylesheet to this UI These must be added before the UI has been opened, adding after that will have no effect
@param file string The name of the CSS file from /nano/css (e.g. "my_style.css")
@return nothing
add_template
Add a template for this UI Templates are combined with the data sent to the UI to create the rendered view These must be added before the UI has been opened, adding after that will have no effect
@param key string The key which is used to reference this template in the frontend @param filename string The name of the template file from /nano/templates (e.g. "my_template.tmpl")
@return nothing
close
Close this UI
@return nothing
get_config_data
Get config data to sent to the ui.
@return /list config data
get_html
Return the HTML for this UI
@return string HTML for the UI
get_send_data
Get data to sent to the ui.
@param data /list The list of general data for this ui (can be null to use previous data sent)
@return /list data to send to the ui
on_close_winset
Set the UI window to call the nanoclose verb when the window is closed This allows Nano to handle closed windows
@return nothing
open
Open this UI
@return nothing
push_data
Push data to an already open UI window
@return nothing
reinitialise
Reinitialise this UI, potentially with a different template and/or initial data
@return nothing
set_auto_update
Set the ui to auto update (every master_controller tick)
@param state int (bool) Set auto update to 1 or 0 (true/false)
@return nothing
set_auto_update_content
Set the ui to update the main content (re-render it) on each update
@param state int (bool) Set update to 1 or 0 (true/false) (default 1)
@return nothing
set_auto_update_layout
Set the ui to update the layout (re-render it) on each update, turning this on will break the map ui (if it's being used)
@param state int (bool) Set update to 1 or 0 (true/false) (default 0)
@return nothing
set_initial_data
Set the initial data for the ui. This is vital as the data structure set here cannot be changed when pushing new updates.
@param data /list The list of data for this ui
@return nothing
set_layout_key
Set the layout key for use in the frontend Javascript The layout key is the basic layout key for the page Two files are loaded on the client based on the layout key varable: -> a template in /nano/templates with the filename "layout_<layout_key>.tmpl -> a CSS stylesheet in /nano/css with the filename "layout_<layout_key>.css
@param nlayout string The layout key to use
@return nothing
set_map_z_level
Toggle showing the map ui
@param nstate_key boolean 1 to show map, 0 to hide (default is 0)
@return nothing
set_show_map
Toggle showing the map ui
@param nstate_key boolean 1 to show map, 0 to hide (default is 0)
@return nothing
set_state_key
Set the state key for use in the frontend Javascript
@param nstate_key string The key of the state to use
@return nothing
set_status
Set the current status (also known as visibility) of this ui.
@param state int The status to set, see the defines at the top of this file @param push_update int (bool) Push an update to the ui to update it's status (an update is always sent if the status has changed to red (0))
@return nothing
set_window_options
Set the browser window options for this ui
@param nwindow_options string The new window options
@return nothing
try_update
Process this UI, updating the entire UI or just the status (aka visibility)
@param update string For this UI to update
@return nothing
update
Update the UI
@return nothing
update_status
Update the status (visibility) of this ui based on the user's status
@param push_update int (bool) Push an update to the ui to update it's status. This is set to 0/false if an update is going to be pushed anyway (to avoid unnessary updates)
@return 1 if closed, null otherwise.
use_on_close_logic
Set whether or not to use the "old" on close logic (mainly unset_machine())
@param state int (bool) Set on_close_logic to 1 or 0 (true/false)
@return nothing