Click or drag to resize

JavaScript Class

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.

Note: This singleton can be disabled at build-time to improve security. By default, the JavaScript singleton is enabled. Official export templates also have the JavaScript singleton enabled. See Compiling for the Web in the documentation for more information.

Inheritance Hierarchy
SystemObject
  GodotJavaScript

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public static class JavaScript

The JavaScript type exposes the following members.

Properties
  NameDescription
Public propertyStatic memberSingleton
Top
Methods
  NameDescription
Public methodStatic memberEval

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.

Top
See Also