Crates.io | windowless_sleep |
lib.rs | windowless_sleep |
version | 0.1.1 |
source | src |
created_at | 2023-10-16 19:59:12.826841 |
updated_at | 2023-10-16 19:59:12.826841 |
description | A sleep function for wasm that doesn't rely on window |
homepage | |
repository | https://github.com/futurepaul/windowless_sleep/ |
max_upload_size | |
id | 1005082 |
size | 2,293 |
The web-sys crate uses the window
object to access the global setTimeout function, which doesn't work in contexts like web workers, WASI, node.js, or, most importantly, bun.
This is a version of sleep that just uses whatever global setTimeout function happens to exist. No idea if this will help with WASI but it works in web workers and bun.