Statejs is an event-driven finite state machine implementation for JavaScript.