Games Node.js Process Lifecycle

Process Lifecycle

beforeExit, exit, exit codes, unref, signals and graceful shutdown.

0 / 8 levels · 0 / 24 ★Start playing ›
  1. Process Lifecycle

    Node is a restaurant at closing time. It stays open while anything is booked: a timer, an open socket, pending work. When the book is empty it calls last orders ('beforeExit'), then shuts the doors ('exit'). process.exit() is the fire alarm: everyone leaves now.

Your rulebook

Finish a level to add its rule. Fill the book and you can explain all of this in an interview.

  1. 1Finish Nothing booked, Node leaves to unlock this rule.
  2. 2Finish Last orders can book more to unlock this rule.
  3. 3Finish The doors are shut to unlock this rule.
  4. 4Finish process.exit() is the fire alarm to unlock this rule.
  5. 5Finish exitCode lets the work finish to unlock this rule.
  6. 6Finish A complaint nobody answered to unlock this rule.
  7. 7Finish A knock at the door to unlock this rule.
  8. 8Finish unref(): a booking that doesn't count to unlock this rule.