Browsers, Deno, Cloudflare Workers and other JavaScript runtimes have adopted the web platform standard of making globalThis extend from EventTarget and support events like unhandledreject, rejectionhandled, and error using the ErrorEvent, PromiseRejectionEvent, etc APIs. Node.js, on the other hand, for legacy reasons does not have these and instead offers it's own variation on these events using process and EventEmitter.
The WinterTC will be standardizing on globalThis extending from EventTarget and using the web platform standard events ... see https://github.com/wintercg/proposal-minimum-common-api/pull/82/files#diff-5e793325cd2bfc452e268a4aa2f02b4024dd9584bd1db3c2595f61f1ecf7b985R124
I would like us to revisit this and consider making globalThis and EventTarget and begin the slow, painful process of migrating away from process-based events, at least where there are existing web platform standard alternatives.
Why would we do this? Cross-runtime interop mainly.
@nodejs/tsc
Browsers, Deno, Cloudflare Workers and other JavaScript runtimes have adopted the web platform standard of making
globalThisextend fromEventTargetand support events likeunhandledreject,rejectionhandled, anderrorusing theErrorEvent,PromiseRejectionEvent, etc APIs. Node.js, on the other hand, for legacy reasons does not have these and instead offers it's own variation on these events usingprocessandEventEmitter.The WinterTC will be standardizing on
globalThisextending fromEventTargetand using the web platform standard events ... see https://github.com/wintercg/proposal-minimum-common-api/pull/82/files#diff-5e793325cd2bfc452e268a4aa2f02b4024dd9584bd1db3c2595f61f1ecf7b985R124I would like us to revisit this and consider making
globalThisandEventTargetand begin the slow, painful process of migrating away fromprocess-based events, at least where there are existing web platform standard alternatives.Why would we do this? Cross-runtime interop mainly.
@nodejs/tsc