chore: Using "listenerCount" instead of "listeners" (#1184)

This commit is contained in:
Grand 2018-04-27 23:48:51 +08:00 committed by Yiyu He
parent 45464b5174
commit 45903f228a

View file

@ -125,7 +125,7 @@ module.exports = class Application extends Emitter {
callback() {
const fn = compose(this.middleware);
if (!this.listeners('error').length) this.on('error', this.onerror);
if (!this.listenerCount('error')) this.on('error', this.onerror);
const handleRequest = (req, res) => {
const ctx = this.createContext(req, res);