/** * callback example */ function cb() { console.log('\n 1st callback is executed!'); console.log('BEFORE 2nd CALLBACK'); setTimeout(function () { console.log('\n 2nd callback is executed'); }, 2000); console.log('AFTER 2nd CALLBACK'); } console.log('BEFORE 1st CALLBACK'); setTimeout(cb, 3000); console.log('AFTER 1st CALLBACK'); /* $node 02callback_settimeout2 BEFORE 1st CALLBACK AFTER 1st CALLBACK 1st callback is executed! BEFORE 2nd CALLBACK AFTER 2nd CALLBACK 2nd callback is executed */
BEFORE 1st CALLBACK AFTER 1st CALLBACK 1st callback is executed! BEFORE 2nd CALLBACK AFTER 2nd CALLBACK 2nd callback is executed
$ps -aux | grep node (list all node processes) sasa 849 0.5 0.5 1319424 88088 ? Ssl Oct08 283:32 node /home/sasa/regoch/regoch-www/server sasa 880 0.4 0.5 1319240 87352 ? Ssl Oct08 235:58 node /home/sasa/dex8/dex8-www/server/index.js sasa 890 0.5 0.5 11797800 85052 ? Ssl Oct08 334:49 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js sasa 903 0.7 0.4 1329652 81868 ? Ssl Oct08 431:29 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js sasa 929 0.4 0.4 1300184 68712 ? Ssl Oct08 226:31 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js sasa 943 0.4 0.4 1300808 66492 ? Ssl Oct08 233:37 node /home/sasa/dex8/dex8-kiosk/server/index.js sasa 980 0.6 0.5 11795444 82456 ? Ssl Oct08 365:04 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js sasa 981 0.7 0.6 1148036 104320 ? Ssl Oct08 395:27 node /home/sasa/voovuu/voovuu-api/starter.js sasa 1039 0.9 1.5 11947012 247172 ? Ssl Oct08 555:33 node /home/sasa/voovuu/voovuu-pub/server/index.js sasa 2044488 0.3 0.4 1298112 66624 ? Ssl Nov01 77:37 node /home/sasa/dex8/dex8-panel/server/index.js sasa 2574087 0.3 0.4 11792920 77444 ? Ssl Nov08 42:14 node /home/sasa/@mikosoft/dodo-examples/server/index.js sasa 2702010 0.4 0.6 22296696 100320 ? Ssl Nov10 35:24 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702011 0.3 0.4 1100276 66808 ? Ssl Nov10 31:31 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702018 0.3 0.3 1100396 65312 ? Ssl Nov10 31:34 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702019 0.3 0.4 1100516 67204 ? Ssl Nov10 31:32 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702046 0.9 0.7 22311780 123656 ? Ssl Nov10 84:39 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702047 0.3 0.4 1100516 66160 ? Ssl Nov10 31:50 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702088 0.3 0.4 1100520 66424 ? Ssl Nov10 31:34 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702089 0.3 0.4 1100520 67328 ? Ssl Nov10 31:30 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702137 0.3 0.4 1099864 66268 ? Ssl Nov10 31:21 node /home/sasa/dex8/dex8-worker/starter.js sasa 2702139 0.4 0.6 22297196 101224 ? Ssl Nov10 35:55 node /home/sasa/dex8/dex8-worker/starter.js sasa 3097623 1.1 0.8 11716736 131200 ? Ssl Nov13 44:35 node /home/sasa/dex8/dex8-api/starter.js www-data 3370161 0.0 0.0 2608 596 ? S 09:46 0:00 sh -c ps -aux | grep node www-data 3370163 0.0 0.0 3304 656 ? S 09:46 0:00 grep node