Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 410 Bytes

README.md

File metadata and controls

27 lines (19 loc) · 410 Bytes

bare-worker

Higher-level worker threads for JavaScript.

npm i bare-worker

Usage

const Worker = require('bare-worker')

if (Worker.isMainThread) {
  const worker = new Worker(__filename)

  worker.on('message', console.log).on('exit', (code) => {
    console.log('Worker exited with code', code)
  })
} else {
  Worker.parentPort.postMessage('Hello worker')
}

License

Apache-2.0