Rename stateListener funtion to emit.