Run your codes in background js or extend node by c++ closures
发布于 8 个月前 作者 classfellow 364 次浏览 来自 分享

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-interpret.png

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.

回到顶部