mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-11 12:23:20 +00:00
Ok Modified the worker it should catch via vite.
This commit is contained in:
1 parent
5e3d79e91e
commit
1fe0296d73
2 files changed
+16
-15
No files matched your search
@@ -217,18 +217,10 @@ export class RenderEngine {
|
||||
if (typeof SharedWorker !== "undefined") {
|
||||
console.log("Shared Workers are supported in this browser.");
|
||||
// Debug chrome://inspect/#workers
|
||||
if (import.meta.env.DEV) {
|
||||
this.diffusionWorker = new DiffusionSharedWorkerClient(
|
||||
"src\\KonvaApp\\SharedWorkers\\Diffusion\\DiffusionSharedWorker.ts",
|
||||
this.onRenderingSystemMessageRecieved,
|
||||
);
|
||||
} else {
|
||||
console.log("Initializing Shared Worker");
|
||||
this.diffusionWorker = new DiffusionSharedWorkerClient(
|
||||
"workers/DiffusionSharedWorker.ts",
|
||||
this.onRenderingSystemMessageRecieved,
|
||||
);
|
||||
}
|
||||
this.diffusionWorker = new DiffusionSharedWorkerClient(
|
||||
"src\\KonvaApp\\SharedWorkers\\Diffusion\\DiffusionSharedWorker.ts",
|
||||
this.onRenderingSystemMessageRecieved,
|
||||
);
|
||||
|
||||
this.canUseSharedWorker = true;
|
||||
} else {
|
||||
|
||||
@@ -27,9 +27,18 @@ export class DiffusionSharedWorkerClient<
|
||||
) => void,
|
||||
) {
|
||||
this.messageReceived = messageReceived;
|
||||
this.sharedWorker = new SharedWorker(workerPath, {
|
||||
type: "module",
|
||||
});
|
||||
if (import.meta.env.DEV) {
|
||||
this.sharedWorker = new SharedWorker(workerPath, {
|
||||
type: "module",
|
||||
});
|
||||
} else {
|
||||
this.sharedWorker = new SharedWorker(
|
||||
new URL(workerPath, import.meta.url),
|
||||
{
|
||||
type: "module",
|
||||
},
|
||||
);
|
||||
}
|
||||
this.port = this.sharedWorker.port;
|
||||
this.port.onmessage = this.onMessage.bind(this);
|
||||
this.port.start();
|
||||
|
||||
Reference in new issue
Block a user