diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-09-07 09:29:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-07 09:29:42 +0200 |
commit | fffdbb38e390a11d0dc0672ce1755148deee3e90 (patch) | |
tree | 740b882c2920d746af4b558d3e654178417c1a46 /doc | |
parent | 61644f1dbe5389ed02a13f0940b05699db645919 (diff) | |
parent | 48f9069f3a443204fb20d5da468093265d03553c (diff) |
Merge pull request #65239 from Geequlim/js2web
Rename JavaScript singleton to JavaScriptBridge
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 4 | ||||
-rw-r--r-- | doc/classes/JavaScriptBridge.xml (renamed from doc/classes/JavaScript.xml) | 6 | ||||
-rw-r--r-- | doc/classes/JavaScriptObject.xml | 16 |
3 files changed, 13 insertions, 13 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 5ec1b4051c..86804e2c4c 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -1275,8 +1275,8 @@ The [JavaClassWrapper] singleton. [b]Note:[/b] Only implemented on Android. </member> - <member name="JavaScript" type="JavaScript" setter="" getter=""> - The [JavaScript] singleton. + <member name="JavaScriptBridge" type="JavaScriptBridge" setter="" getter=""> + The [JavaScriptBridge] singleton. [b]Note:[/b] Only implemented on the Web platform. </member> <member name="Marshalls" type="Marshalls" setter="" getter=""> diff --git a/doc/classes/JavaScript.xml b/doc/classes/JavaScriptBridge.xml index c838422e85..5e36b5cc80 100644 --- a/doc/classes/JavaScript.xml +++ b/doc/classes/JavaScriptBridge.xml @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> -<class name="JavaScript" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> +<class name="JavaScriptBridge" inherits="Object" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> Singleton that connects the engine with the browser's JavaScript context in Web export. </brief_description> <description> - The JavaScript singleton is implemented only in the Web export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs. - [b]Note:[/b] 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 [url=$DOCS_URL/development/compiling/compiling_for_web.html]Compiling for the Web[/url] in the documentation for more information. + The JavaScriptBridge singleton is implemented only in the Web export. It's used to access the browser's JavaScript context. This allows interaction with embedding pages or calling third-party JavaScript APIs. + [b]Note:[/b] This singleton can be disabled at build-time to improve security. By default, the JavaScriptBridge singleton is enabled. Official export templates also have the JavaScriptBridge singleton enabled. See [url=$DOCS_URL/development/compiling/compiling_for_web.html]Compiling for the Web[/url] in the documentation for more information. </description> <tutorials> <link title="Exporting for the Web: Calling JavaScript from script">$DOCS_URL/tutorials/export/exporting_for_web.html#calling-javascript-from-script</link> diff --git a/doc/classes/JavaScriptObject.xml b/doc/classes/JavaScriptObject.xml index e279acf5a4..26792bd19e 100644 --- a/doc/classes/JavaScriptObject.xml +++ b/doc/classes/JavaScriptObject.xml @@ -1,27 +1,27 @@ <?xml version="1.0" encoding="UTF-8" ?> <class name="JavaScriptObject" inherits="RefCounted" version="4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> <brief_description> - A wrapper class for native JavaScript objects. + A wrapper class for web native JavaScript objects. </brief_description> <description> - JavaScriptObject is used to interact with JavaScript objects retrieved or created via [method JavaScript.get_interface], [method JavaScript.create_object], or [method JavaScript.create_callback]. + JavaScriptObject is used to interact with JavaScript objects retrieved or created via [method JavaScriptBridge.get_interface], [method JavaScriptBridge.create_object], or [method JavaScriptBridge.create_callback]. Example: [codeblock] extends Node - var _my_js_callback = JavaScript.create_callback(self, "myCallback") # This reference must be kept - var console = JavaScript.get_interface("console") + var _my_js_callback = JavaScriptBridge.create_callback(self, "myCallback") # This reference must be kept + var console = JavaScriptBridge.get_interface("console") func _init(): - var buf = JavaScript.create_object("ArrayBuffer", 10) # new ArrayBuffer(10) + var buf = JavaScriptBridge.create_object("ArrayBuffer", 10) # new ArrayBuffer(10) print(buf) # prints [JavaScriptObject:OBJECT_ID] - var uint8arr = JavaScript.create_object("Uint8Array", buf) # new Uint8Array(buf) + var uint8arr = JavaScriptBridge.create_object("Uint8Array", buf) # new Uint8Array(buf) uint8arr[1] = 255 prints(uint8arr[1], uint8arr.byteLength) # prints 255 10 console.log(uint8arr) # prints in browser console "Uint8Array(10) [ 0, 255, 0, 0, 0, 0, 0, 0, 0, 0 ]" - # Equivalent of JavaScript: Array.from(uint8arr).forEach(myCallback) - JavaScript.get_interface("Array").from(uint8arr).forEach(_my_js_callback) + # Equivalent of JavaScriptBridge: Array.from(uint8arr).forEach(myCallback) + JavaScriptBridge.get_interface("Array").from(uint8arr).forEach(_my_js_callback) func myCallback(args): # Will be called with the parameters passed to the "forEach" callback |