Skip to content

Commit

Permalink
refactor(index.page.tsx): replace custom timeout function with built-…
Browse files Browse the repository at this point in the history
…in setTimeout for better readability and maintainability
  • Loading branch information
ymekuria committed Sep 22, 2024
1 parent 0180302 commit 0a5ca19
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,13 @@ export default function Home() {
// Do Setup

useEffect(() => {
async function timeout(seconds: number): Promise<void> {
return new Promise<void>((resolve) => {
setTimeout(() => {
resolve();
}, seconds * 1000);
});
}

async function setup() {
if (!state.hasBeenSetup) {
setDisplayText('Loading web worker...');
console.log('Loading web worker...');
const zkappWorkerClient = new ZkappWorkerClient();
await timeout(5);
await new Promise((resolve) => setTimeout(resolve, 5000));

setDisplayText('Done loading web worker');
console.log('Done loading web worker');
Expand Down

0 comments on commit 0a5ca19

Please sign in to comment.