Skip to content

Commit d46e020

Browse files
committed
fixup: use listenerCount instead of _events
1 parent e4e4e0a commit d46e020

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/domain.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,7 @@ EventEmitter.prototype.emit = function emit(...args) {
402402

403403
const type = args[0];
404404
const doError = type === 'error' &&
405-
this._events !== undefined &&
406-
this._events.error !== undefined;
405+
this.listenerCount(type) > 0;
407406

408407
if (doError || domain === null || domain === undefined || this === process) {
409408
return Reflect.apply(eventEmit, this, args);

0 commit comments

Comments
 (0)