Repository navigation
Support CustomEvent #40678
Copy link
Copy link
Closed
Labels
eventtargetIssues and PRs related to the EventTarget implementation.Issues and PRs related to the EventTarget implementation.feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
Description
Activity
- addedeventtargetIssues and PRs related to the EventTarget implementation.Issues and PRs related to the EventTarget implementation.
on Oct 31, 2021 - addedfeature requestIssues requesting new Node.js features.Issues requesting new Node.js features.
on Nov 1, 2021 - added a commit that references this issue
on Feb 10, 2022 There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment.
For more information on how the project manages feature requests, please consult the feature request management document.
- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on May 1, 2022 Yet another polyfill proposal that:
- handles no
options; - uses
nullfor the default value ofdetail; - define
detailreadonly.
class CustomEvent extends Event { #detail; constructor(type, options) { super(type, options); this.#detail = options?.detail ?? null; } get detail() { return this.#detail; } }
- handles no
- removedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on May 16, 2022 For anyone wanting to work on this, the steps to take are:
- Enable the dom/events WPT tests in test/wpt
- Make them pass for regular Events/EventTargets
- Then start working on CustomEvent
W.r.t. (1):
diff --git a/test/wpt/status/dom/events.json b/test/wpt/status/dom/events.json new file mode 100644 index 00000000000..0967ef424bc --- /dev/null +++ b/test/wpt/status/dom/events.json @@ -0,0 +1 @@ +{} diff --git a/test/wpt/test-events.js b/test/wpt/test-events.js new file mode 100644 index 00000000000..5040d56d6a2 --- /dev/null +++ b/test/wpt/test-events.js @@ -0,0 +1,7 @@ +'use strict'; +require('../common'); +const { WPTRunner } = require('../common/wpt'); + +const runner = new WPTRunner('dom/events'); + +runner.runJsTests();
Where dom/events is https://github.com/web-platform-tests/wpt/tree/master/dom/events
- addedhelp wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.
on May 17, 2022 - added a commit that references this issue
on Jun 22, 2022 10 remaining items
- added a commit that references this issue
on Jul 31, 2022 - added 2 commits that reference this issue
on Aug 2, 2022 - added 3 commits that reference this issue
on Oct 10, 2022 - added a commit that references this issue
on Aug 9, 2024
Metadata
Metadata
Assignees
Labels
eventtargetIssues and PRs related to the EventTarget implementation.Issues and PRs related to the EventTarget implementation.feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.good first issueIssues that are suitable for first-time contributors.Issues that are suitable for first-time contributors.help wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
Is your feature request related to a problem? Please describe.
When trying to mimic browser APIs surrounding
EventTarget, we frequently useCustomEventwhich is currently unavailable in Node.It's useful in that it allows us to dispatch events through an
EventTargetand include a custom data payload.In a some way, this is the closest we have to a standardised
ObservableAPI (specificallySubject) and it's very useful.Describe the solution you'd like
CustomEventexistsDescribe alternatives you've considered
Writing a polyfill