cross-runtime
One task, timer, and runtime surface across native Tokio and browser WebAssembly.
let task = spawn;
assert_eq!;
sleep.await;
The package is named cross-runtime; consumers may use the compact crate name:
= { = "cross-runtime", = "0.1" }
Runtime mapping
| Surface | Native | wasm32-unknown-unknown |
|---|---|---|
spawn |
Tokio Send task |
web-task Send task |
spawn_local |
current Tokio LocalSet |
current browser thread |
Runtime |
owned or injected Tokio runtime | ambient browser runtime |
sleep, timeout |
Tokio clock | wasmtimer browser clock |
JoinHandle follows Tokio lifecycle semantics on both targets: dropping a handle detaches the task, while abort() requests cancellation.
Browser tests
The browser suite runs the #[wasm_bindgen_test] cases inside a real headless Chrome instance through ChromeDriver:
This is the behavioral gate for browser scheduling, detachment, cancellation, and timer semantics; compiling the wasm test artifacts alone does not exercise them.
License
Licensed under either Apache-2.0 or MIT, at your option.