INNER CODE UNIT · TypeScript
test2
andywer/threads.js · test-tooling/webpack/app.ts:23
async function test2() {
// We also want to test if referencing multiple different workers in a module
// built using webpack works
const add = await spawn<AdditionWorker>(new Worker("./addition-worker"))
const result = await add(2, 3)
if (result !== 5) {
throw Error("Unexpected result returned by addition worker: " + result)
}
}
async function test3() {
if (!(process as any).browser) {
// Running workers from remote URLs is disabled in node.js
return
}