Skip to content

Commit

Permalink
feat(04-zkapp-ui-with-react.mdx): create worker instance
Browse files Browse the repository at this point in the history
  • Loading branch information
ymekuria committed Sep 30, 2024
1 parent 3d75ac5 commit bcc530c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bcc530c

Please sign in to comment.