1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Replace XML codeblock spaces with tabs

This commit is contained in:
kobewi
2025-05-17 20:00:17 +02:00
committed by Rémi Verschelde
parent 5dd76968d8
commit 13f642d959
122 changed files with 2407 additions and 2432 deletions

View File

@@ -12,25 +12,25 @@
var console = JavaScriptBridge.get_interface("console")
func _init():
var buf = JavaScriptBridge.create_object("ArrayBuffer", 10) # new ArrayBuffer(10)
print(buf) # Prints [JavaScriptObject:OBJECT_ID]
var uint8arr = JavaScriptBridge.create_object("Uint8Array", buf) # new Uint8Array(buf)
uint8arr[1] = 255
prints(uint8arr[1], uint8arr.byteLength) # Prints "255 10"
var buf = JavaScriptBridge.create_object("ArrayBuffer", 10) # new ArrayBuffer(10)
print(buf) # Prints [JavaScriptObject:OBJECT_ID]
var uint8arr = JavaScriptBridge.create_object("Uint8Array", buf) # new Uint8Array(buf)
uint8arr[1] = 255
prints(uint8arr[1], uint8arr.byteLength) # Prints "255 10"
# Prints "Uint8Array(10) [ 0, 255, 0, 0, 0, 0, 0, 0, 0, 0 ]" in the browser's console.
console.log(uint8arr)
# Prints "Uint8Array(10) [ 0, 255, 0, 0, 0, 0, 0, 0, 0, 0 ]" in the browser's console.
console.log(uint8arr)
# Equivalent of JavaScriptBridge: Array.from(uint8arr).forEach(myCallback)
JavaScriptBridge.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
# [0, 0, [JavaScriptObject:1173]]
# [255, 1, [JavaScriptObject:1173]]
# ...
# [0, 9, [JavaScriptObject:1180]]
print(args)
# Will be called with the parameters passed to the "forEach" callback
# [0, 0, [JavaScriptObject:1173]]
# [255, 1, [JavaScriptObject:1173]]
# ...
# [0, 9, [JavaScriptObject:1180]]
print(args)
[/codeblock]
[b]Note:[/b] Only available in the Web platform.
</description>