-
Notifications
You must be signed in to change notification settings - Fork 37
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
Windowless sleep #757
Windowless sleep #757
Conversation
Is there a way we can do this without having to add javascript, or at least a library that does this for us? |
This could be worth trying instead https://docs.rs/async-std/latest/async_std/task/fn.sleep.html |
Agreed, no js. Make it into a rust crate and we'll add it :P
Why is this a problem though? |
For Javascript environments that aren't a browser |
does this work with wasm? tried looking at the impl but I couldn't quite follow it |
yeah this is helpful for WASI or node contexts, but also there's no "window" object in a web worker |
idk, was hoping you'd test 😅 |
f43c0dc
to
47b0208
Compare
lol it's not if this tracking issue is real async-rs/async-std#220 |
47b0208
to
005e66d
Compare
23d49c0
to
9cd5760
Compare
windowless_sleep = "0.1.1" |
cb2a337
to
328571f
Compare
328571f
to
d4d6c43
Compare
Is this good to merge? It would be good to remove local storage. |
Should be okay |
d4d6c43
to
6ad8290
Compare
Needs rebase. |
6ad8290
to
8e929f8
Compare
web-sys calls the "window" object for setTimeout, but that's not actually necessary (setTimeout is available in js environments without a window, like node). Also, it seems like the web-sys console_log is only used for tests, so with that we can move the web-sys dep entirely to dev-dependencies
this all seems to work fine in browser but I can't figure out how to run the tests on my mac