Last active
June 25, 2018 08:17
-
-
Save chnbohwr/6459aa115a42951fc988852ea7b45e68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Worker } = require('worker_threads'); | |
const path = require('path'); | |
const worker1 = new Worker(path.resolve('./worker.js')); | |
worker1.on('message', (message) => { | |
console.log(`main thread get message: ${message}`); | |
}); | |
worker1.postMessage('hello world'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment