Difference between revisions of "JS"

From GiderosMobile
(updated example by sinistersoft)
m (Text replacement - "<source" to "<syntaxhighlight")
Line 9: Line 9:
 
=== Example ===
 
=== Example ===
 
'''Get/Set'''
 
'''Get/Set'''
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
-- sets a variable and a listener
 
-- sets a variable and a listener
 
JS.eval([[
 
JS.eval([[

Revision as of 14:28, 13 July 2023

Supported platforms: Platform html5.png
Available since: 2019.1

Description

Runs JavaScript code.

Example

Get/Set <syntaxhighlight lang="lua"> -- sets a variable and a listener JS.eval([[ document.isPause = false; document.addEventListener('visibilitychange', function() { if (document.visibilityState == 'hidden') document.isPause = true; else document.isPause = false; }); ]])

-- gets the value of a variable print(JS.eval("document.isPause")) </source>

Methods

JS.eval executes the given JavaScript code

Events

Constants