Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Fix worker_pool for node

Jason Miller09f65d0cd78d
diff --git a/cli/src/worker_pool.js b/cli/src/worker_pool.js
index e14374f6..5d474185 100644
--- a/cli/src/worker_pool.js
+++ b/cli/src/worker_pool.js
@@ -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 });
});