Light-weight state machine library for JavaScript