From bcc530c515f7b8a855c44bb47331e62bf18ccd86 Mon Sep 17 00:00:00 2001 From: ymekuria Date: Mon, 30 Sep 2024 09:32:57 -0700 Subject: [PATCH] feat(04-zkapp-ui-with-react.mdx): create worker instance --- docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx b/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx index aaa172627..2663725d3 100644 --- a/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx +++ b/docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx @@ -242,6 +242,12 @@ Comlink.expose(api); The web worker client code resides in the `04-zkapp-browser-ui/ui/app/zkappWorkerClient.ts` file. Here you create a client in the main thread that interacts with the web worker. +- In the constructor create a new Worker instance pointing to the `zkappWorker.ts` file. + ```ts + constructor() { + // Initialize the worker from the zkappWorker module + const worker = new Worker(new URL('./zkappWorker.ts', import.meta.url), { type: 'module' }); + ``` ### Environment configuration