Simple, node/browser compatible generic FSM system