Skip to content

Instantly share code, notes, and snippets.

@chnbohwr
Created June 25, 2018 07:37
Show Gist options
  • Save chnbohwr/fb901c40cacff6f4972628b974f4a3e6 to your computer and use it in GitHub Desktop.
Save chnbohwr/fb901c40cacff6f4972628b974f4a3e6 to your computer and use it in GitHub Desktop.
const { parentPort, workerData } = require('worker_threads');
console.log(workerData);
let b = 0;
for (let i = 0; i < 1000; i += workerData.base) {
b += i;
}
parentPort.postMessage(b);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment