Fix worker_pool for node

This commit is contained in:
Jason Miller
2020-10-05 22:38:23 -04:00
parent 261b3ad013
commit 09f65d0cd7

View File

@ -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 });
});