event emitter base finate-state machine