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:
parent
938008622c
commit
bd323b62ea
@ -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))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user