Run bevy systems in wasm even when the tab is not focused
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
It seems like if the user switches to a different tab, the bevy app will basically freeze and stop getting updated.
This seems to be because running the schedule in wasm is tied to `requestAnimationFrame` (https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame) calls which are made by winit in the winit_runner.
A potential solution would be:
- if the tab is focused, keep the current scheduling logic
- if the tab is not focused, update the schedule at fixed intervals (for example 60Hz(
Contributor guide
Research direction
Start at the winit_runner scheduling path and read how requestAnimationFrame drives the wasm schedule. Compare focused and unfocused browser behavior, then determine how fixed-interval updates should coexist with the current focused-tab logic. Done means wasm systems continue updating when the tab is unfocused without changing focused-tab scheduling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- game-dev, web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100