🚥 comlink-loader tentatively working

This commit is contained in:
2021-04-27 14:35:14 -07:00
parent d38309001f
commit a4715efe04
7 changed files with 29 additions and 56 deletions

View File

@@ -2,8 +2,7 @@ import * as React from "react";
import _ from "lodash";
import { connect } from "react-redux";
import * as Comlink from "comlink";
import ExpensiveProcessor from "comlink-loader!../workers/extractCovers.worker";
import { greet } from "../workers/extractCovers.worker";
interface IProps {
matches: unknown;
}
@@ -28,8 +27,7 @@ class Import extends React.Component<IProps, IState> {
}
public async startFolderWalk() {
const worker = Comlink.proxy(new ExpensiveProcessor());
console.log(new worker());
console.log(await greet('dog'));
}
public render() {
return (

View File

@@ -1,3 +1,3 @@
export async function greet(subject: string): string {
return `Hello, ${subject}!`;
}
}

View File

@@ -1,13 +0,0 @@
{
"compilerOptions": {
"strict": true,
"target": "esnext",
"module": "esnext",
"lib": ["webworker", "esnext"],
"moduleResolution": "node",
"noUnusedLocals": true,
"sourceMap": true,
"allowJs": false,
"baseUrl": "."
}
}