Macro wasm_bindgen::link_to
source · link_to!() { /* proc-macro */ }
Expand description
This macro takes a JS module as input and returns a URL that can be used to access it at runtime.
The module can be specified in a few ways:
- You can use
inline_js = "..."
to create an inline JS file. - You can use
module = "/foo/bar"
to reference a file relative to the root of the crate the macro is invoked in.
The returned URL can be used for things like creating workers/worklets:
use web_sys::Worker;
let worker = Worker::new(&wasm_bindgen::link_to!(module = "/src/worker.js"));