Skip to content
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

missing use for delay_ms in the doc of using coroutine #144

Closed
ifsheldon opened this issue Oct 15, 2023 · 3 comments
Closed

missing use for delay_ms in the doc of using coroutine #144

ifsheldon opened this issue Oct 15, 2023 · 3 comments

Comments

@ifsheldon
Copy link

Where does this delay_ms come from? I don't see it anywhere. Can someone give me a pointer please?

@ealmloff
Copy link
Member

That isn't intended to be a runnable block of code. If you want to sleep for a certain amount of time you can use async-std's sleep function: https://docs.rs/async-std/latest/async_std/task/fn.sleep.html

@ifsheldon
Copy link
Author

Thanks! Probably you should mention this using a code comment. So, async-std is a recommended async library to use in conjunction with Dioxus?

@ealmloff
Copy link
Member

ealmloff commented Oct 16, 2023

Thanks! Probably you should mention this using a code comment.

There are a bunch of different places in the docs that use sudo code that is not intended to be runnable. We could add comments to each one, but what might be better is to remove the copy button and add some visual indicator to the code block like a sudocode marker at the top right. We could add the marker whenever we see the no-run flag on the code block in https://github.com/DioxusLabs/include_mdbook

So, async-std is a recommended async library to use in conjunction with Dioxus?

It depends what platform you are targeting, but async-std is a good default. The larger alternative it tokio, but it has poor web support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants