From bd323b62ea912b2107bad1cc0f19f58d6bc06c4b Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Sat, 11 May 2024 11:43:06 -0700 Subject: [PATCH] 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 --- lib/internal/event_target.js | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/internal/event_target.js b/lib/internal/event_target.js index 6a774eb9446..a807732e484 100644 --- a/lib/internal/event_target.js +++ b/lib/internal/event_target.js @@ -408,15 +408,6 @@ ObjectDefineProperties(CustomEvent.prototype, { detail: kEnumerableProperty, }); -class NodeCustomEvent extends Event { - constructor(type, options) { - super(type, options); - if (options?.detail) { - this.detail = options.detail; - } - } -} - // Weak listener cleanup // This has to be lazy for snapshots to work let weakListenersState = null; @@ -837,7 +828,7 @@ class EventTarget { } [kCreateEvent](nodeValue, type) { - return new NodeCustomEvent(type, { detail: nodeValue }); + return new CustomEvent(type, { detail: nodeValue }); } [customInspectSymbol](depth, options) { if (!isEventTarget(this))