-
Notifications
You must be signed in to change notification settings - Fork 160
Description
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
and, in an example,
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.