godotengine / godotengine/godot-docs
Need better examples for JavaScriptObject
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
Godot v4.1.1.stable
**Issue description:**
There are massive holes about JavaScriptBridge and JavaScriptObject. There is no example how to convert JS values to be readable value on Godot side. I could find only one example about interacting with JS - https://github.com/Pukkah/HTML5-File-Exchange-for-Godot/blob/master/addons/HTML5FileExchange/HTML5FileExchange.gd it is for Godot 3.
In Godot 4 it is impossible to read ArrayBuffer or Uint8Array as it is passed to Godot, because now it is JavaScriptObject.
Primitive base variable types like String, int, float, bool is passed as such. That doesn't work when need to load files through ArrayBuffer and expected on the Godot side as PackedByteArray. Using callback functions doesn't convert to expected variable types and instead everything is JavaScriptObject.
**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_javascriptobject.html
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.