Crates.io | launch-worker |
lib.rs | launch-worker |
version | 0.1.0 |
source | src |
created_at | 2023-02-26 21:22:18.811598 |
updated_at | 2023-02-26 21:22:18.811598 |
description | Launch Wasm code in web workers |
homepage | https://github.com/sgasse/launch-worker |
repository | https://github.com/sgasse/launch-worker |
max_upload_size | |
id | 795486 |
size | 4,919 |
Highly WIP. Current usage:
fn startup() {
let worker = worker_from_runner("MyRunner", "my_pkg_name").unwrap();
}
#[wasm_bindgen]
pub struct MyRunner;
#[wasm_bindgen]
impl MyRunner {
pub fn new() -> Self {
Self
}
pub fn init(&self) {
console::log_1(&JsValue::from_str("MyRunner initialized"));
}
pub fn onmessage(&mut self, msg: MessageEvent) {
console::log_1(&format!("MyRunner received: {msg:?}").into());
}
}