diff --git a/examples-gpu/hello-worker.js b/examples-gpu/hello-worker.js new file mode 100644 index 000000000000..59596f831025 --- /dev/null +++ b/examples-gpu/hello-worker.js @@ -0,0 +1 @@ +import("./wasm/hello.js").then(module => module.default()); diff --git a/examples-gpu/index.html b/examples-gpu/index.html index f2f5d50b0362..b076a2536bc9 100644 --- a/examples-gpu/index.html +++ b/examples-gpu/index.html @@ -67,6 +67,7 @@ "skybox", // "texture-arrays", // "water", + "hello-worker", ]; const list = document.createElement("ul"); for (let exampleName of exampleNames) { @@ -82,7 +83,10 @@ const currentExample = new URLSearchParams(window.location.search).get( "example" ); - if (currentExample) { + if (currentExample === "hello-worker") { + console.info("Note: loading modules in web workers is currently not supported on Firefox"); + const worker = new Worker("hello-worker.js", { type: "module" }); + } else if (currentExample) { import(`./wasm/${currentExample}.js`).then((module) => module.default()); } else { window.location.assign(