JavaScript

Inherits: Object

Singleton that connects the engine with the browser's JavaScript context in HTML5 export.

Description

The JavaScript singleton is implemented only in the HTML5 export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs.

Tutorials

Methods

Variant eval ( String code, bool use_global_execution_context=false )

Method Descriptions

Variant eval ( String code, bool use_global_execution_context=false )

Execute the string code as JavaScript code within the browser window. This is a call to the actual global JavaScript function eval().

If use_global_execution_context is true, the code will be evaluated in the global execution context. Otherwise, it is evaluated in the execution context of a function within the engine's runtime environment.

© 2014–2020 Juan Linietsky, Ariel Manzur, Godot Engine contributors
Licensed under the MIT License.
https://docs.godotengine.org/en/3.2/classes/class_javascript.html