events: replace NodeCustomEvent with CustomEvent

PR-URL: https://github.com/nodejs/node/pull/43876
Refs: https://github.com/nodejs/node/pull/43514
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
Feng Yu 2024-05-11 11:43:06 -07:00 committed by GitHub
parent 938008622c
commit bd323b62ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -408,15 +408,6 @@ ObjectDefineProperties(CustomEvent.prototype, {
detail: kEnumerableProperty, detail: kEnumerableProperty,
}); });
class NodeCustomEvent extends Event {
constructor(type, options) {
super(type, options);
if (options?.detail) {
this.detail = options.detail;
}
}
}
// Weak listener cleanup // Weak listener cleanup
// This has to be lazy for snapshots to work // This has to be lazy for snapshots to work
let weakListenersState = null; let weakListenersState = null;
@ -837,7 +828,7 @@ class EventTarget {
} }
[kCreateEvent](nodeValue, type) { [kCreateEvent](nodeValue, type) {
return new NodeCustomEvent(type, { detail: nodeValue }); return new CustomEvent(type, { detail: nodeValue });
} }
[customInspectSymbol](depth, options) { [customInspectSymbol](depth, options) {
if (!isEventTarget(this)) if (!isEventTarget(this))