Emitting events on state change.