Uh oh!
There was an error while loading. Please reload this page.
events: add max listener warning for EventTarget - #36001
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
benjamingr
left a comment
There was a problem hiding this comment.
Looks good - except the static on EventTarget.
Domenic pointed me towards https://heycam.github.io/webidl/#create-an-interface-object that does not allow adding additional properties.
This comment has been minimized.
This comment has been minimized.
34e87e4 to
53dc04dCompare
This comment has been minimized.
This comment has been minimized.
benjamingr
commented
Nov 6, 2020
@jasnell would it be possible to make it static on I think the DOM people and spec feel very strongly that once there are things added it's no longer a spec compliant EventTarget. |
jasnell
commented
Nov 6, 2020
Possible, yes, ideal, no? It would end up needing to be something like... events.setEventTargetMaxListeners(eventTarget,5);Because the limit should be settable per |
jasnell
commented
Nov 6, 2020
Ok, this is the approach I just implemented: constevents=require('events')constet1=newEventTarget();constet2=newEventTarget();events.setEventTargetMaxListeners(15);// Set the default for all EventTargetsevents.setEventTargetMaxListeners(15,et1);// Set the max for et1events.setEventTargetMaxListeners(15,et1,et2);// Set the max for et1 and et2It's not pretty but it works. |
53dc04d to
abb7409Compare
This comment has been minimized.
This comment has been minimized.
abb7409 to
1f87c08Comparenodejs-github-bot
commented
Nov 6, 2020
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jasnell
commented
Nov 12, 2020
I wouldn't see why not to be honest. They are functionally consistent with each other. |
| --> | ||
| * `n` {number} A non-negative number. The maximum number of listeners per | ||
| `EventTarget` event. |
There was a problem hiding this comment.
| `EventTarget`event. | |
| `EventTarget`or `EventEmitter`. |
| `EventTarget` event. | ||
| * `...eventsTargets` {EventTarget[]|EventEmitter[]} Zero or more {EventTarget} | ||
| or {EventEmitter} instances. If none are specified, `n` is set as the default | ||
| max for all newly created {EventTarget} and {EventEmitter} objects. |
There was a problem hiding this comment.
| max for all newlycreated {EventTarget} and {EventEmitter} objects. | |
| maximum for all newly-created {EventTarget} and {EventEmitter} objects. |
Landed in cd31340...dc79f3f |
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: TODO
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: TODO
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: #36232
Notable changes: dns: * (SEMVER-MINOR) add a cancel() method to the promise Resolver (Szymon Marczak) #33099 events: * (SEMVER-MINOR) add max listener warning for EventTarget (James M Snell) #36001 http: * (SEMVER-MINOR) add support for abortsignal to http.request (Benjamin Gruenbaum) #36048 http2: * (SEMVER-MINOR) allow setting the local window size of a session (Yongsheng Zhang) #35978 lib: * (SEMVER-MINOR) add throws option to fs.f/l/statSync (Andrew Casey) #33716 path: * (SEMVER-MINOR) add `path/posix` and `path/win32` alias modules (ExE Boss) #34962 readline: * (SEMVER-MINOR) add getPrompt to get the current prompt (Mattias Runge-Broberg) #33675 src: * (SEMVER-MINOR) add loop idle time in diagnostic report (Gireesh Punathil) #35940 util: * (SEMVER-MINOR) add `util/types` alias module (ExE Boss) #34055 PR-URL: #36232
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: nodejs#36001Fixes: nodejs#35990 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Fixes: #35990
Signed-off-by: James M Snell jasnell@gmail.com
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes