Skip to content

Commit

Permalink
Merge pull request #29 from chemicstry/inline_polyfill
Browse files Browse the repository at this point in the history
Make module workers polyfill inline
  • Loading branch information
chemicstry authored Oct 14, 2024
2 parents 7bc7dcc + 12a9b09 commit ef852c7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
12 changes: 5 additions & 7 deletions src/wasm32/js/module_workers_polyfill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ impl Builder {

#[cfg(feature = "es_modules")]
{
utils::load_module_workers_polyfill();
js_sys::eval(include_str!("js/module_workers_polyfill.min.js")).unwrap();
options.type_(WorkerType::Module);
}
#[cfg(not(feature = "es_modules"))]
Expand Down
6 changes: 0 additions & 6 deletions src/wasm32/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ pub fn is_web_worker_thread() -> bool {
js_sys::eval("self").unwrap().dyn_into::<WorkerGlobalScope>().is_ok()
}

#[cfg(feature = "es_modules")]
#[wasm_bindgen(module = "/src/wasm32/js/module_workers_polyfill.min.js")]
extern "C" {
pub fn load_module_workers_polyfill();
}

/// Extracts path of the `wasm_bindgen` generated .js shim script.
///
/// Internally, this intentionally generates a javascript exception to obtain a stacktrace containing the current script
Expand Down

0 comments on commit ef852c7

Please sign in to comment.