diff --git a/templates/widget/index.ts b/templates/widget/index.ts index 7b4ffbd5..ddca5da3 100644 --- a/templates/widget/index.ts +++ b/templates/widget/index.ts @@ -55,7 +55,7 @@ export const solveCaptchaRunner = async (e: Event): Promise => { worker.onmessage = async (event: MessageEvent) => { const resp: ServiceWorkerWork = event.data; console.log( - `Proof generated. Difficuly: ${config.difficulty_factor} Duration: ${resp.duration}` + `Proof generated. Difficuly: ${config.difficulty_factor} Duration: ${resp.work.time}` ); const proof: Work = { @@ -63,7 +63,7 @@ export const solveCaptchaRunner = async (e: Event): Promise => { string: config.string, nonce: resp.work.nonce, result: resp.work.result, - time: resp.work.time, + time: Math.trunc(resp.work.time), worker_type: resp.work.worker_type, }; diff --git a/templates/widget/service-worker.ts b/templates/widget/service-worker.ts index 00975bad..0b350071 100644 --- a/templates/widget/service-worker.ts +++ b/templates/widget/service-worker.ts @@ -19,15 +19,9 @@ onmessage = async (e) => { console.debug("message received at worker"); const config: PoWConfig = e.data; - const t0 = performance.now(); const work = await prove(config); - - const t1 = performance.now(); - const duration = t1 - t0; - const res: ServiceWorkerWork = { work, - duration, }; postMessage(res); diff --git a/templates/widget/types.ts b/templates/widget/types.ts index efc91596..32da1490 100644 --- a/templates/widget/types.ts +++ b/templates/widget/types.ts @@ -32,7 +32,6 @@ export type WasmWork = { export type ServiceWorkerWork = { work: SubmitWork; - duration: number; }; export type PoWConfig = {