Fix worker_pool for node
This commit is contained in:
@ -94,8 +94,8 @@ export default class WorkerPool {
|
||||
}
|
||||
|
||||
static useThisThreadAsWorker(cb) {
|
||||
parentPort.addEventListener("message", async ev => {
|
||||
const { msg, id } = ev.data;
|
||||
parentPort.on("message", async data => {
|
||||
const { msg, id } = data;
|
||||
const result = await cb(msg);
|
||||
parentPort.postMessage({ result, id });
|
||||
});
|
||||
|
Reference in New Issue
Block a user