https://github.com/classfellow/rcib
RCIB(running codes in background js) is a node.js package for providing ability to run js codes in background or a way to extend node.js by C++ closures.
RCIB relove cpu-bound tasks for node.js, it works as follow picture:
you use it like this:
rcib.postTask( path.join(__dirname, './background.js'), 'globalFunction2',
JSON.stringify({a:100, b: 200}), function (err, value) {
if(err) console.error(err)
else console.log(value)
})
globalFunction2 is a CPU-intensive work in background js, it runs in other thread, when finished ,callback will run in main loop.