check undefined before use
use local emitter instead a global one