-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[tracking] browser WASM support #220
Comments
Should we introduce Or should we perhaps have What if every thread was technically a worker thread onto which local tasks can be spawned? We could have thread-local task queues into which Just some ideas... |
(EDIT: I said something wrong regarding wasm-bindgen-futures, they recently upgraded to stable futures) One challenge is that |
Can we replace Also, since |
Yes, that should be possible. Example (with old futures): https://github.com/tomaka/wasm-timer/blob/fd76bd42824fcee5232959df3f8a15cb58e33c46/src/wasm.rs#L209-L278
Yes. one can use performance.now(). The problem is that it is clearly a hack to assume that |
@davidbarsky mentioned something like this earlier; that's very interesting! @tomaka I was thinking of sidestepping Perhaps it would actually make sense to add a
I've talked with the wasm team about this, and they recommended to do feature detection for |
I don't understand what you mean by that? |
@tomaka feature flag it as: #[cfg(all(feature = "wasm-bindgen", target_arch = "wasm32"))] as recommended by the wasm team. Not 100%, but better than just |
So we would need three code paths:
|
@tomaka yeah that's about it for now. Eventually we may want to support WASI too, but async support doesn't exist yet. We should engage the team more closely on this though; it's been a while since we last talked about it in-depth. |
Related project: https://github.com/richardanaya/asynctimer |
The core work of this happened in #757 and will be available in 1.6 |
@yoshuawuyts You have checked
It shows:
EDIT: change to |
i've got this error when running
|
@sergeyt which vesion was that? |
@dignifiedquire It says 1.6.2 :)
|
reading is hard :( |
I think you'll have to add the |
What are the next steps for this issue? I am specifically interested in a WASM-friendly sleep. It looks like there is a working example of this from 3 years ago from the comment above: https://github.com/richardanaya/asynctimer Any progress since then? |
It'd be cool if
async-std
worked in the browser out of the box. Not everything can be supported, but we can support a smaller subset.Tasks
--target wasm32-unknown-unknown
targettask::spawn
work (usewasm_bindgen_futures::spawn_local
)stream
task::sleep
async-attributes
to allowasync fn main
to workReferences
The text was updated successfully, but these errors were encountered: