JavaScript

Inherits: Object

Singleton que conecta el motor con el contexto JavaScript del navegador en la exportación HTML5.

Descripción

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.

Métodos

JavaScriptObject

create_callback ( Object object, String method )

Variant

create_object ( String object, ... ) vararg

void

download_buffer ( PoolByteArray buffer, String name, String mime="application/octet-stream" )

Variant

eval ( String code, bool use_global_execution_context=false )

JavaScriptObject

get_interface ( String interface )

Descripciones de Métodos

Creates a reference to a script function that can be used as a callback by JavaScript. The reference must be kept until the callback happens, or it won't be called at all. See JavaScriptObject for usage.


Creates a new JavaScript object using the new constructor. The object must a valid property of the JavaScript window. See JavaScriptObject for usage.


Prompts the user to download a file containing the specified buffer. The file will have the given name and mime type.

Note: The browser may override the MIME type provided based on the file name's extension.

Note: Browsers might block the download if download_buffer is not being called from a user interaction (e.g. button click).

Note: Browsers might ask the user for permission or block the download if multiple download requests are made in a quick succession.


Ejecute la string code como código JavaScript dentro de la ventana del navegador. Esta es una llamada a la función global actual de JavaScript eval().

Si use_global_execution_context es true, el código será evaluado en el contexto de ejecución global. De lo contrario, se evaluará en el contexto de ejecución de una función dentro del entorno de tiempo de ejecución del motor.


Returns an interface to a JavaScript object that can be used by scripts. The interface must be a valid property of the JavaScript window. The callback must accept a single Array argument, which will contain the JavaScript arguments. See JavaScriptObject for usage.