Run your codes in background js or extend node by c++ closures

35 views
Skip to first unread message

Jia You

unread,
Nov 11, 2015, 8:55:16 AM11/11/15
to nodejs
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.

Reply all
Reply to author
Forward
0 new messages