That looks like it fits with the theme, but events are difficult to compose & tend to have easy leaks by requiring explicit attach/detach (not that I'm sure the proposal here addresses those issues)
Re:A proposal to add signals to JavaScript
by pcthrowaway on Monday April 01, 2024 @01:23AM
(#39891155)
Could you not just compose a new EventEmitter constructor that uses the new FinalizationRegistry API to drop all handlers of subjects which have since been garbage collected?
https://nodejs.org/en/learn/asynchronous-work/the-nodejs-eve...