Skip to content

Higher-level worker threads for JavaScript

License

Notifications You must be signed in to change notification settings

holepunchto/bare-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Higher-level worker threads for JavaScript

Resources

License

Stars

Watchers

Forks