Describe the Bug
When spawning a web worker with gloo-worker, a warning message is printed to the console:
using deprecated parameters for the initialization function; pass a single object instead
This comes from the use of wasm_bindgen("URL") (which refers to / runs __wbg_init("URL")), a parameter format which was deprecated in wasm-bindgen v0.2.93 in favor of wasm_bindgen({module_or_path: "URL"}).
The places I found that can cause this bug are
https://github.com/rustwasm/gloo/blob/d600d3ac934b1c62b7009c22eabe2f91be4bd974/crates/worker/src/actor/spawner.rs#L32
and, in an example,
https://github.com/rustwasm/gloo/blob/d600d3ac934b1c62b7009c22eabe2f91be4bd974/examples/clock/index.html#L11-L13
Steps to Reproduce
Conveniently, the clock example almost causes the issue, aside from using a pre-0.2.93 version of wasm-bindgen. Modify the clock example's Cargo.toml to depend on wasm-bindgen v0.2.93, and from the clock example's directory, run wasm-pack build --target no-modules --out-name clock, and serve the example's index.html in some way (e.g. python3 -m http.server). Opening the site in a browser and opening the developer console shows the deprecation warning.
Expected Behavior
No warnings should be printed to the console for correct code using gloo-worker.
Actual Behavior
Creating a web worker with gloo-worker causes a deprecation warning to be printed to the console.
Additional Context
I used gloo-worker v0.5.0, and the warning occurred on Safari, Chrome, and Firefox (presumably also on any supported browser). Note that many crates don't seem to have updated to the newer wasm_bindgen() format, so this deprecation warning might still occur in other contexts even if this issue is fixed.
Describe the Bug
When spawning a web worker with gloo-worker, a warning message is printed to the console:
using deprecated parameters for the initialization function; pass a single object insteadThis comes from the use of
wasm_bindgen("URL")(which refers to / runs__wbg_init("URL")), a parameter format which was deprecated in wasm-bindgen v0.2.93 in favor ofwasm_bindgen({module_or_path: "URL"}).The places I found that can cause this bug are
https://github.com/rustwasm/gloo/blob/d600d3ac934b1c62b7009c22eabe2f91be4bd974/crates/worker/src/actor/spawner.rs#L32
and, in an example,
https://github.com/rustwasm/gloo/blob/d600d3ac934b1c62b7009c22eabe2f91be4bd974/examples/clock/index.html#L11-L13
Steps to Reproduce
Conveniently, the clock example almost causes the issue, aside from using a pre-0.2.93 version of wasm-bindgen. Modify the clock example's Cargo.toml to depend on wasm-bindgen v0.2.93, and from the clock example's directory, run
wasm-pack build --target no-modules --out-name clock, and serve the example's index.html in some way (e.g.python3 -m http.server). Opening the site in a browser and opening the developer console shows the deprecation warning.Expected Behavior
No warnings should be printed to the console for correct code using gloo-worker.
Actual Behavior
Creating a web worker with gloo-worker causes a deprecation warning to be printed to the console.
Additional Context
I used gloo-worker v0.5.0, and the warning occurred on Safari, Chrome, and Firefox (presumably also on any supported browser). Note that many crates don't seem to have updated to the newer wasm_bindgen() format, so this deprecation warning might still occur in other contexts even if this issue is fixed.