Skip to content

Commit f568ad3

Browse files
committed
fix capture
1 parent 924f08e commit f568ad3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/js/node/events.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ function EventEmitter(opts) {
6767
this[kCapture] = !!opts.captureRejections;
6868
this.emit = emitWithRejectionCapture;
6969
} else {
70+
this[kCapture] = EventEmitterPrototype[kCapture];
7071
const capture = EventEmitterPrototype[kCapture];
7172
this[kCapture] = capture;
72-
this.emit = capture ? emitWithRejectionCapture : emitWithoutRejectionCapture;
73+
if (capture) {
74+
this.emit = emitWithRejectionCapture;
75+
}
7376
}
7477
}
7578
Object.defineProperty(EventEmitter, "name", { value: "EventEmitter", configurable: true });

0 commit comments

Comments
 (0)