Add API exposing web-sys/HTML DOM
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Hey, I’m working on an interactive webcomic thing and I want to embed a game into the comic that will change to a new page or reveal a new html element or something once the player triggers something in game. In order to do that, I would need to acess the HTML dom from Bevy.
## What solution would you like?
I could use an api inside bevy, maybe something like bevy_web, that has all the bindings and api for web stuff that I would want. It would wrap web-sys, but put it in an ECS context.
## What alternative(s) have you considered?
I COULD make a custom runner And basically alternate between web-sys calls and updating your Bevy app and then dump a list of things that I would want to do in web-sys into a resource / event stream that lives in my app. I could then access that inside my custom runner.
However that’s much too much work for what I want to do, since I might as well use pure JavaScript since that would be much easier to manage. Additionally, I’m probably not the only one that would want to access the HTML DOM from Bevy, and all of us having to write boilerplate every single time sounds annoying.
## Additional context
Godot already sorta does this with their JavaScript bridge.
https://docs.godotengine.org/en/stable/classes/class_javascript.html
They turned the JavaScript browser context into a singleton that any node can access.
Contributor guide
Assessment
This issue has not been assessed yet.