1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

[HTML5] Implement Godot <-> JavaScript interface.

This commit is contained in:
Fabio Alessandrelli
2021-01-26 10:06:29 +01:00
parent fcfce4be67
commit 730a894bcf
9 changed files with 797 additions and 172 deletions

View File

@@ -11,6 +11,26 @@
<link>https://docs.godotengine.org/en/3.3/getting_started/workflow/export/exporting_for_web.html#calling-javascript-from-script</link>
</tutorials>
<methods>
<method name="create_callback">
<return type="JavaScriptObject">
</return>
<argument index="0" name="object" type="Object">
</argument>
<argument index="1" name="method" type="String">
</argument>
<description>
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.
</description>
</method>
<method name="create_object" qualifiers="vararg">
<return type="Variant">
</return>
<argument index="0" name="object" type="String">
</argument>
<description>
Creates a new JavaScript object using the [code]new[/code] constructor. The [code]object[/code] must a valid property of the JavaScript [code]window[/code]. See [JavaScriptObject] for usage.
</description>
</method>
<method name="eval">
<return type="Variant">
</return>
@@ -23,6 +43,15 @@
If [code]use_global_execution_context[/code] is [code]true[/code], 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.
</description>
</method>
<method name="get_interface">
<return type="JavaScriptObject">
</return>
<argument index="0" name="interface" type="String">
</argument>
<description>
Returns an interface to a JavaScript object that can be used by scripts. The [code]interface[/code] must be a valid property of the JavaScript [code]window[/code]. The callback must accept a single [Array] argument, which will contain the JavaScript [code]arguments[/code]. See [JavaScriptObject] for usage.
</description>
</method>
</methods>
<constants>
</constants>