JS FSM, a state based finite state machine for javascript