Event Driven Finite State Machine in JavaScript

The fsm is runnin' now, buddy.