🍔 Worker biting back
This commit is contained in:
@@ -1,19 +1,3 @@
|
||||
// const worker: DedicatedWorkerGlobalScope = self as any;
|
||||
|
||||
// worker.onmessage = ({ data }) => {
|
||||
// if (data instanceof Array) {
|
||||
// worker.postMessage(data.join(" ") + "!");
|
||||
// }
|
||||
// };
|
||||
|
||||
import { expose } from "comlink";
|
||||
|
||||
class ExpensiveProcessor {
|
||||
_foo: string;
|
||||
/* ... async methods here ... */
|
||||
constructor() {
|
||||
this._foo = "rishi";
|
||||
}
|
||||
}
|
||||
|
||||
expose(ExpensiveProcessor, self);
|
||||
export async function greet(subject: string): string {
|
||||
return `Hello, ${subject}!`;
|
||||
}
|
||||
Reference in New Issue
Block a user