diff options
Diffstat (limited to 'src/worker-script/node/index.js')
-rw-r--r-- | src/worker-script/node/index.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/worker-script/node/index.js b/src/worker-script/node/index.js index 15cb3fb..c00dba7 100644 --- a/src/worker-script/node/index.js +++ b/src/worker-script/node/index.js @@ -9,6 +9,7 @@ */ const fetch = require('node-fetch'); +const { parentPort } = require('worker_threads'); const worker = require('..'); const getCore = require('./getCore'); const gunzip = require('./gunzip'); @@ -17,8 +18,8 @@ const cache = require('./cache'); /* * register message handler */ -process.on('message', (packet) => { - worker.dispatchHandlers(packet, (obj) => process.send(obj)); +parentPort.on('message', (packet) => { + worker.dispatchHandlers(packet, (obj) => parentPort.postMessage(obj)); }); worker.setAdapter({ |