rfd icon indicating copy to clipboard operation
rfd copied to clipboard

How to actually use AsyncFileDialog in WASM?

Open JohnDowson opened this issue 2 years ago • 1 comments

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.

JohnDowson avatar Dec 05 '23 20:12 JohnDowson

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

ManevilleF avatar Jan 14 '24 18:01 ManevilleF