SHARE
TWEET

Untitled

a guest Mar 21st, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { workerData, parentPort, isMainThread } = require("worker_threads");
  2.  
  3. // You can do any heavy stuff here, in a synchronous way
  4. // without blocking the "main thread"
  5. parentPort.on("message", message => {
  6.   if (message === "exit") {
  7.     parentPort.postMessage("sold!");
  8.     parentPort.close();
  9.   } else {
  10.     parentPort.postMessage({ going: message });
  11.   }
  12. });
  13.  
  14. parentPort.postMessage({ start: workerData, isMainThread });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top