Fix javascript event emitter