🍔 Worker biting back
This commit is contained in:
@@ -2,7 +2,7 @@ import * as React from "react";
|
||||
import _ from "lodash";
|
||||
import { connect } from "react-redux";
|
||||
import * as Comlink from "comlink";
|
||||
import ExpensiveProcessor from "worker-loader!../workers/extractCovers.worker";
|
||||
import ExpensiveProcessor from "comlink-loader!../workers/extractCovers.worker";
|
||||
|
||||
interface IProps {
|
||||
matches: unknown;
|
||||
|
||||
12
src/client/types/index.d.ts
vendored
12
src/client/types/index.d.ts
vendored
@@ -9,12 +9,12 @@ declare module "*.png" {
|
||||
// export default ImportComicBooksWorker;
|
||||
// }
|
||||
|
||||
declare module "worker-loader!*" {
|
||||
class WebpackWorker extends Worker {
|
||||
constructor();
|
||||
}
|
||||
export default WebpackWorker;
|
||||
}
|
||||
// declare module "worker-loader!*" {
|
||||
// class WebpackWorker extends Worker {
|
||||
// constructor();
|
||||
// }
|
||||
// export default WebpackWorker;
|
||||
// }
|
||||
|
||||
declare module "*.jpg";
|
||||
declare module "*.gif";
|
||||
|
||||
@@ -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