godotengine / godotengine/godot-docs
JavaScript Bridge Does Not Work
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
Version 4.3
I cannot get data to transfer from a javascript variable to godot variable. Documentation is inadequate and provides no examples.
The use-case is using JavaScript I download a JSON file from API in on WebGL platform. The variable is playerId = "1234". I should be able to use JavaScriptBridge in GDScript to create a new variable:
`var Player = JavaScriptBridge.create_object("String", "playerId")`
Now the variable is in GDScript, I can use it through the game and display it on the UI. For example:
`label.text = "Your ID: ", Player`
and it should display Your ID: 1234
I know there's another issue like this, but it's labeled as a feature request. This is a bug because the documentation says this is supposed to work and it doesn't.
Please fix this.
`JavaScript number is returned as [:ref:`class_float`](https://github.com/godotengine/godot-docs/blob/4.3/tutorials/platform/web/javascript_bridge.rst#id13)
JavaScript boolean is returned as [:ref:`class_bool`](https://github.com/godotengine/godot-docs/blob/4.3/tutorials/platform/web/javascript_bridge.rst#id15)
JavaScript string is returned as [:ref:`class_String`](https://github.com/godotengine/godot-docs/blob/4.3/tutorials/platform/web/javascript_bridge.rst#id17)`
[**URL to the documentation page:**](https://github.com/godotengine/godot-docs/blob/4.3/tutorials/platform/web/javascript_bridge.rst)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.