Title: RFC - EventTarget API Enhancements · Issue #36073 · nodejs/node · GitHub
Open Graph Title: RFC - EventTarget API Enhancements · Issue #36073 · nodejs/node
X Title: RFC - EventTarget API Enhancements · Issue #36073 · nodejs/node
Description: I've started working on an API enhancement for EventTarget that allows passing a signal to the options dictionary of addEventListener. As a side node I've prototyped the same for Node.js EventEmitter at #35877 (currently blocked on somet...
Open Graph Description: I've started working on an API enhancement for EventTarget that allows passing a signal to the options dictionary of addEventListener. As a side node I've prototyped the same for Node.js EventEmitt...
X Description: I've started working on an API enhancement for EventTarget that allows passing a signal to the options dictionary of addEventListener. As a side node I've prototyped the same for Node.js Ev...
Opengraph URL: https://github.com/nodejs/node/issues/36073
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RFC - EventTarget API Enhancements","articleBody":"I've started working on an API enhancement for EventTarget that allows passing a signal to the options dictionary of `addEventListener`. As a side node I've prototyped the same for Node.js EventEmitter at https://github.com/nodejs/node/pull/35877 (currently blocked on something V8 is working on).\r\n\r\nThis would let uses do the following:\r\n\r\n```js\r\n// Does not yet work, suggested:\r\nconst ac = new AbortController();\r\nlet { signal } = ac;\r\nconst et = new EventTarget();\r\net.addEventListener('foo', (e) =\u003e {\r\n \r\n}, { signal } );\r\nac.abort(); // removes the listener from the event target, same as et.removeEventListener('foo', thatFunctionReference)\r\n```\r\n\r\nIn node land - this would be for example: unsubscribing from `\"message\"` and `abort` at the same time on multiple workers.\r\n\r\nI wanted this feature for Node but I also find it very useful for browsers. I'm pretty clueless at this (Bikeshed etc) and Anne and Domenic have been helping me a ton with the spec work.\r\n\r\nI personally think this positively impacts Node because:\r\n - Node was in my mind when I started working on this\r\n - I will happily do the technical part of implementing this in our EventTarget\r\n\r\nThat said: too many times in the past Node was an afterthought in open standards the project participates in and I want to gather feedback in case there are unforeseen negative consequences from our side.\r\n\r\nSo - is there anything this should do differently?\r\n\r\n--- \r\n\r\n**I would _personally strongly_ prefer it if comments were given in this issue first** to reduce the noise for WHATWG folks who have been helping me on this but really don't owe me anything.\r\n \r\nCurrently I have a spec draft ready at: https://github.com/whatwg/dom/pull/919\r\nInitial Chromium implementation (by chromium at https://github.com/whatwg/dom/issues/911#issuecomment-724885708 )\r\nImplementor interest by Firefox and Chromium.","author":{"url":"https://github.com/benjamingr","@type":"Person","name":"benjamingr"},"datePublished":"2020-11-10T19:03:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/36073/node/issues/36073"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:67613c2e-421c-9a20-a2b2-9b00eabfe3ec |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C540:1661F0:1300909:1948AC9:6A52A895 |
| html-safe-nonce | 52cd8bf0ba47a12a0b838f5523faabe1e4f402a4bf5f1b2399257cd829ec7adb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNTQwOjE2NjFGMDoxMzAwOTA5OjE5NDhBQzk6NkE1MkE4OTUiLCJ2aXNpdG9yX2lkIjoiMTA0MDY2NTA3MTQ1NjUyODUzMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9beba09a33e5e621733f51940fe37a0443c31e92f8f325baaaf30c80d73d03b0 |
| hovercard-subject-tag | issue:740167156 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/36073/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be1aab19b48808cf7284e49b667f46552d245bbedd46032d2e50a169fa0e7d6d/nodejs/node/issues/36073 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be1aab19b48808cf7284e49b667f46552d245bbedd46032d2e50a169fa0e7d6d/nodejs/node/issues/36073 |
| og:image:alt | I've started working on an API enhancement for EventTarget that allows passing a signal to the options dictionary of addEventListener. As a side node I've prototyped the same for Node.js EventEmitt... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | benjamingr |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width