Make `Task`s functional on WASM
Objective
Right not bevy's task pool abstraction is kind of useless on wasm, since it returns a FakeTask which can't be interacted with. This is only good for fire-and-forget it tasks, and isn't even that useful since it's just a thin wrapper around wasm-bindgen-futures::spawn_local
Solution
Add a simple Task<T> handler type to wasm targets that allow waiting for a task's output or periodically checking for its completion. This PR aims to give the wasm version of these tasks feature parity with the native, multi-threaded version of the task
Testing
- Did you test these changes? Not yet
@kettle11 can I get your review here please?
I don't agree that this is contentious, it's just finishing an incomplete feature. The considerations here are in terms of implementation details, not direction IMO
This conceptually looks fine to me, but @JoJoJet have you checked that this still runs with the atomics flag enabled?
This PR has instructions for how to build with that enabled: https://github.com/bevyengine/bevy/pull/12205
That PR enabled Bevy Wasm to compile with threading enabled and make use of other libraries to spawn threads, parallelize, etc. even if Bevy Wasm itself isn't yet threaded internally.
I haven't tested that functionality yet but I see no reason it would stop working. I'm hoping that with this PR, full multi-threading support will just be a drop-in addition that utilizes this same interface
Thank you to everyone involved with the authoring or reviewing of this PR! This work is relatively important and needs release notes! Head over to https://github.com/bevyengine/bevy-website/issues/1660 if you'd like to help out.