await worker is ready

This commit is contained in:
mitallast
2024-03-05 13:42:10 +03:00
parent cba056aba6
commit ddc3008009
4 changed files with 25 additions and 4 deletions

View File

@@ -9,6 +9,12 @@ import prove from "./prove";
import { PoWConfig, ServiceWorkerMessage, ServiceWorkerWork } from "./types";
log.log("worker registered");
const ready: ServiceWorkerMessage = {
type: "ready",
};
postMessage(ready);
onmessage = async (e) => {
console.debug("message received at worker");
const config: PoWConfig = e.data;