Test JS script file

Selected file: 02callback_settimeout.js
Compare console.log() outputs in browser and NodeJS.
Notice: Open browser's console in FireBUG!

  1. 01callback.js
  2. 02callback_settimeout.js
  3. 02callback_settimeout2.js
  4. 50bluebird_basic.js
  5. 50bluebird_newPromise.js
  6. 51bluebird_fs.js

..:: Source code - 02callback_settimeout.js ::..

/**
 * callback example which shows that all 3 functions runs in paralel
 */

console.log('BEFORE CALLBACK');

setTimeout(function () {
  console.log('inside callback');
}, 3000);

console.log('AFTER CALLBACK');


/* $node 02callback_settimeout
BEFORE CALLBACK
AFTER CALLBACK
inside callback
 */
 

..:: NodeJS Console - 02callback_settimeout.js ::..

$ node 02callback_settimeout.js
BEFORE CALLBACK
AFTER CALLBACK
inside callback
$ps -aux | grep node (list all node processes)
sasa        1194  0.5  0.4 1303452 80368 ?       Ssl  Oct24 271:13 node /home/sasa/.pm2/modules/pm2-logrotate/node_modules/pm2-logr
sasa        1200  0.9  0.8 11723120 138600 ?     Ssl  Oct24 475:49 node /home/sasa/dex8/dex8-api/starter.js
sasa        1207  0.4  0.4 1304140 72968 ?       Ssl  Oct24 223:09 node /home/sasa/regoch/regoch-www/server
sasa        1208  0.3  0.4 1304912 72544 ?       Ssl  Oct24 194:25 node /home/sasa/dex8/dex8-panel/server/index.js
sasa        1224  0.9  0.5 11801636 93476 ?      Ssl  Oct24 468:53 node /home/sasa/dex8/dex8-www/server/index.js
sasa        1236  0.5  0.5 11812620 97496 ?      Ssl  Oct24 297:39 node /home/sasa/mikosoft_hr/www-mikosoft-hr/server/index.js
sasa        1255  0.7  0.5 1330860 84040 ?       Ssl  Oct24 398:34 node /home/sasa/mikosoft-info/api-mikosoft-info/starter.js
sasa        1257  0.3  0.4 1301028 69352 ?       Ssl  Oct24 197:35 node /home/sasa/mikosoft-info/www-mikosoft-info/server/index.js
sasa        1289  0.3  0.4 1297724 67516 ?       Rsl  Oct24 194:52 node /home/sasa/dex8/dex8-kiosk/server/index.js
sasa        1363  3.1  2.7 12152692 447772 ?     Ssl  Oct24 1658:30 node /home/sasa/voovuu/voovuu-pub/server/index.js
sasa        1449  0.3  0.3 1166568 64272 ?       Ssl  Oct24 204:13 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1528  1.7  2.6 33114568 441000 ?     Ssl  Oct24 906:38 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1529  0.3  0.4 1102948 66260 ?       Ssl  Oct24 204:03 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1606  0.3  0.3 1100132 64128 ?       Ssl  Oct24 204:06 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1607  0.3  0.4 1103204 67236 ?       Ssl  Oct24 203:30 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1705  0.3  0.4 1101416 65612 ?       Ssl  Oct24 203:26 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1706  0.3  0.3 1101412 64600 ?       Ssl  Oct24 203:22 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1805  0.3  0.4 1167200 66152 ?       Ssl  Oct24 203:35 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1807  0.3  0.4 1102432 66356 ?       Ssl  Oct24 199:27 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1885  0.3  0.3 1101416 65212 ?       Ssl  Oct24 200:48 node /home/sasa/dex8/dex8-worker/starter.js
sasa        1886  1.6  0.9 11857744 160004 ?     Ssl  Oct24 867:32 node /home/sasa/mikosoft-info/crypto-mikosoft-info/server/index.
sasa     2628167  0.8  0.7 1170068 126268 ?      Ssl  Nov04 300:16 node /home/sasa/voovuu/voovuu-api/starter.js
sasa     3168557  0.6  0.5 11801548 90920 ?      Ssl  Nov06 213:14 node /home/sasa/mikosoft-info/dodo-mikosoft-info/server/index.js
sasa     3169051  0.4  0.5 11798408 83560 ?      Ssl  Nov06 139:18 node /home/sasa/@mikosoft/dodo-examples/server/index.js
www-data 3728754  0.0  0.0   2608   528 ?        S    16:09   0:00 sh -c ps -aux | grep node
www-data 3728756  0.0  0.0   3304   712 ?        S    16:09   0:00 grep node