This commit is contained in:
Manav Rathi 2024-04-20 21:54:43 +05:30
parent 30fe91efb9
commit feb8814ac1
No known key found for this signature in database

View file

@ -1,19 +1,6 @@
import { haveWindow } from "@/next/env";
import { ComlinkWorker } from "@/next/worker/comlink-worker";
import { Remote } from "comlink";
import { DedicatedConvertWorker } from "worker/convert.worker";
class ComlinkConvertWorker {
private comlinkWorkerInstance: Remote<DedicatedConvertWorker>;
async getInstance() {
if (!this.comlinkWorkerInstance) {
this.comlinkWorkerInstance =
await getDedicatedConvertWorker().remote;
}
return this.comlinkWorkerInstance;
}
}
import { type DedicatedConvertWorker } from "worker/convert.worker";
export const getDedicatedConvertWorker = () => {
if (haveWindow()) {
@ -26,5 +13,3 @@ export const getDedicatedConvertWorker = () => {
return cryptoComlinkWorker;
}
};
export default new ComlinkConvertWorker();