/**
* callback as function parameter
*/
//define function with callback
function fja(p1, cb) {
res = p1 +10;
cb(p1);
}
//define parameters
var x=2;
//callback as an object
var obj = {
cb1: function(a) {
console.log('cb1: '+a);
},
cb2: function(a) {
console.log('cb2: '+a);
}
}
//call function
var res = fja(x, obj.cb1); //2
cb1: 2
$ps -aux | grep node (list all node processes) sasa 1194 0.5 0.4 1303884 80676 ? Ssl Oct24 272:05 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr sasa 1200 0.9 0.8 11723120 138936 ? Ssl Oct24 477:00 node /home/sasa/dex8/dex8-api/starter.js sasa 1207 0.4 0.4 1304652 72848 ? Ssl Oct24 223:59 node /home/sasa/regoch/regoch-www/server sasa 1208 0.3 0.4 1304912 72948 ? Ssl Oct24 195:04 node /home/sasa/dex8/dex8-panel/server/index.js sasa 1224 0.9 0.6 11825936 103864 ? Ssl Oct24 470:13 node /home/sasa/dex8/dex8-www/server/index.js sasa 1236 0.5 0.5 11811596 96248 ? Ssl Oct24 298:41 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js sasa 1255 0.7 0.5 1330860 84172 ? Ssl Oct24 400:01 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js sasa 1257 0.3 0.4 1301028 69128 ? Ssl Oct24 198:14 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js sasa 1289 0.3 0.4 1297724 66844 ? Ssl Oct24 195:31 node /home/sasa/dex8/dex8-kiosk/server/index.js sasa 1363 3.1 2.8 12178484 470428 ? Ssl Oct24 1665:38 node /home/sasa/voovuu/voovuu-pub/server/index.js sasa 1449 0.3 0.3 1167336 65188 ? Ssl Oct24 204:54 node /home/sasa/dex8/dex8-worker/starter.js sasa 1528 1.7 2.6 33114568 440640 ? Ssl Oct24 907:29 node /home/sasa/dex8/dex8-worker/starter.js sasa 1529 0.3 0.3 1100644 64368 ? Ssl Oct24 204:44 node /home/sasa/dex8/dex8-worker/starter.js sasa 1606 0.3 0.3 1100132 64252 ? Ssl Oct24 204:47 node /home/sasa/dex8/dex8-worker/starter.js sasa 1607 0.3 0.3 1100900 65208 ? Ssl Oct24 204:11 node /home/sasa/dex8/dex8-worker/starter.js sasa 1705 0.3 0.4 1101416 65572 ? Ssl Oct24 204:06 node /home/sasa/dex8/dex8-worker/starter.js sasa 1706 0.3 0.3 1101412 65324 ? Ssl Oct24 204:02 node /home/sasa/dex8/dex8-worker/starter.js sasa 1805 0.3 0.3 1167200 65432 ? Ssl Oct24 204:16 node /home/sasa/dex8/dex8-worker/starter.js sasa 1807 0.3 0.3 1100384 64272 ? Ssl Oct24 200:07 node /home/sasa/dex8/dex8-worker/starter.js sasa 1885 0.3 0.3 1099624 64016 ? Ssl Oct24 201:27 node /home/sasa/dex8/dex8-worker/starter.js sasa 1886 1.6 0.9 11858512 161644 ? Ssl Oct24 872:14 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index. sasa 2628167 0.8 0.7 1170068 126436 ? Ssl Nov04 301:47 node /home/sasa/voovuu/voovuu-api/starter.js sasa 3168557 0.6 0.5 11822028 98208 ? Ssl Nov06 214:29 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js sasa 3169051 0.4 0.5 11798408 83116 ? Ssl Nov06 140:03 node /home/sasa/@mikosoft/dodo-examples/server/index.js www-data 3743864 0.0 0.0 2608 528 ? S 19:47 0:00 sh -c ps -aux | grep node www-data 3743866 0.0 0.0 3304 644 ? S 19:47 0:00 grep node