Skip to content

Commit

Permalink
fix: playground top level await
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Jan 29, 2023
1 parent d313054 commit 6736b94
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions playground/main.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { add } from './worker';
import { add, sub } from './worker';

console.log(await add(1, 2));
async function bootstrap() {
console.log(await add(1, 2));
console.log(await sub(2, 1));
}

bootstrap();

// const worker = new SharedWorker(new URL('./worker/index.ts', import.meta.url), {
// type: 'module',
Expand Down
4 changes: 4 additions & 0 deletions playground/worker/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@
export async function add(a: number, b: number) {
return a + b;
}

export async function sub(a: number, b: number) {
return a - b;
}

0 comments on commit 6736b94

Please sign in to comment.