diff options
Diffstat (limited to 'doc/classes/JavaScriptObject.xml')
-rw-r--r-- | doc/classes/JavaScriptObject.xml | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/doc/classes/JavaScriptObject.xml b/doc/classes/JavaScriptObject.xml index e279acf5a4..7132cc5cad 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]. - Example: + 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]. + [b]Example:[/b] [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 |