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

How to actually use AsyncFileDialog in WASM? #163

Open
JohnDowson opened this issue Dec 5, 2023 · 1 comment
Open

How to actually use AsyncFileDialog in WASM? #163

JohnDowson opened this issue Dec 5, 2023 · 1 comment

Comments

@JohnDowson
Copy link

JohnDowson commented Dec 5, 2023

I got a function, not in the main loop, that needs file from a user.

I used AsyncFilePicker with wasm_bindgen_futures::spawn_local. However, this leads to the function continuing to run past that point and straight into a data race, where the file picker always loses since it is scheduled at the next tick, and the outer function wants to return immediately. I tried to approach this problem with channels, but I can't block the thread to wait on one.

@ManevilleF
Copy link

using either crossbeam-channels or flume you can wait for the channel in a non blocking way with try_iter

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