Skip to content
Discussion options

You must be logged in to vote

Oh, sure! Using async for an intentionally-slow task makes a ton of sense: an async approach here would basically do some work, set a timer or something, yield back to the browser until the timer goes off, then come back and do some more work, etc. Basically if what's causing the slowness is computation, async can't help you (although it can spread it out into non-blocking chunks). But if what's causing the slowness is intentionally blocking the thread for a period of time, async is ideal.

To an async task from the click handler just use spawn_local.

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@danechitoaie
Comment options

@gbj
Comment options

gbj Oct 6, 2023
Maintainer

@danechitoaie
Comment options

@gbj
Comment options

gbj Oct 6, 2023
Maintainer

Answer selected by danechitoaie
@danechitoaie
Comment options

@danechitoaie
Comment options

@gbj
Comment options

gbj Oct 10, 2023
Maintainer

@danechitoaie
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants