This commit is contained in:
Manav Rathi
2024-07-01 15:32:15 +05:30
parent 5988052521
commit ff0f940798

View File

@@ -9,11 +9,8 @@ import { FaceWorker } from "./worker";
let _comlinkWorker: ComlinkWorker<typeof FaceWorker> | undefined;
/** Lazily created, cached, instance of {@link FaceWorker}. */
export const faceWorker = async () => {
let comlinkWorker = _comlinkWorker;
if (!comlinkWorker) _comlinkWorker = comlinkWorker = createComlinkWorker();
return await comlinkWorker.remote;
};
export const faceWorker = async () =>
(_comlinkWorker ??= createComlinkWorker()).remote;
const createComlinkWorker = () =>
new ComlinkWorker<typeof FaceWorker>(