HTML5 - JavaScript functions: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Added a note about console.log-)
m (Clean up formatting)
Line 1: Line 1:
{{Experimental}}
{{Experimental}}
A special class is available to javascript code running inside html5 pages. It allows access to a few values and functions.   
A special class is available to JavaScript code running inside HTML5 pages. It allows access to a few values and functions.   


The class itself is static and is called MapTool.  
The class itself is static and is called {{code|MapTool}}.  


==== Functions ====
==== Functions ====


* getName() - Returns the name of the frame or dialog.  
* {{code|getName()}} - Returns the name of the panel.  
* getKind() - Returns the kind of the frame or dialog (i.e. frame5 or dialog5).
* {{code|getKind()}} - Returns the kind of the panel: {{func|frame5}} or {{func|dialog5}}.
* getuserData() - Returns the data passed to the frame via the "Value" option.  
* {{code|getuserData()}} - Returns the data passed to the panel via the {{code|value}} option.  
* log() - Anything passed to this method will be sent to the chat window, just like a broadcast to self.
* {{code|log()}} - Anything passed to this method will be sent to the chat window, just like a {{func|broadcast}} to {{code|self}}.
Additionally, console.log has been redirected to the chat window as well.  
Additionally, {{code|console.log()}} will be redirected to the chat window as well.  
[[Category:HTML5 javascript]]
[[Category:HTML5 JavaScript]]

Revision as of 03:55, 22 January 2024

 This article describes a feature or macro function that is experimental and may be subject to change.

A special class is available to JavaScript code running inside HTML5 pages. It allows access to a few values and functions.

The class itself is static and is called MapTool.

Functions

  • getName() - Returns the name of the panel.
  • getKind() - Returns the kind of the panel: frame5() or dialog5().
  • getuserData() - Returns the data passed to the panel via the value option.
  • log() - Anything passed to this method will be sent to the chat window, just like a broadcast() to self.

Additionally, console.log() will be redirected to the chat window as well.