Setup example worker
This commit is contained in:
+2
-1
@@ -17,7 +17,8 @@
|
|||||||
"suspicious": {
|
"suspicious": {
|
||||||
"noTsIgnore": "off",
|
"noTsIgnore": "off",
|
||||||
"noAssignInExpressions": "off",
|
"noAssignInExpressions": "off",
|
||||||
"noFallthroughSwitchClause": "warn"
|
"noFallthroughSwitchClause": "warn",
|
||||||
|
"noGlobalAssign": "warn"
|
||||||
},
|
},
|
||||||
"correctness": {
|
"correctness": {
|
||||||
"useParseIntRadix": "off",
|
"useParseIntRadix": "off",
|
||||||
|
|||||||
@@ -85,3 +85,12 @@ function animate(timestamp: number): void {
|
|||||||
|
|
||||||
animate(delta);
|
animate(delta);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
const worker = new Worker(new URL("./worker.ts", import.meta.url), {
|
||||||
|
type: "module",
|
||||||
|
});
|
||||||
|
|
||||||
|
worker.onmessage = (event) => {
|
||||||
|
console.log(event.data);
|
||||||
|
};
|
||||||
|
worker.postMessage("foo");
|
||||||
|
|||||||
+7
-1
@@ -18,7 +18,13 @@ function devTools(): Plugin {
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
server: { host, port, hmr: false },
|
server: { host, port, hmr: false },
|
||||||
build: { target: "esnext" },
|
build: {
|
||||||
|
target: "esnext",
|
||||||
|
main: `${root}index.html`,
|
||||||
|
lib: {
|
||||||
|
entry: `${root}worker.ts`,
|
||||||
|
},
|
||||||
|
},
|
||||||
test: {
|
test: {
|
||||||
include: ["./engine/**/*.test.ts"],
|
include: ["./engine/**/*.test.ts"],
|
||||||
environment: "jsdom",
|
environment: "jsdom",
|
||||||
|
|||||||
Reference in New Issue
Block a user