### What is the problem this feature will solve? The [**`CloseEvent`**](https://developer.mozilla.org/Web/API/CloseEvent) class isn't defined. ### What is the feature you are proposing to solve the problem? Add the `CloseEvent` class in the global scope. I found it in [undici](https://github.com/nodejs/undici/blob/755fc4c/lib/websocket/events.js#L81-L112). ### What alternatives have you considered? Export `CloseEvent` class from [_events_](https://nodejs.org/api/events.html).
Activity
bnoordhuis commentedon Feb 28, 2023
I'm inclined to say exporting
CloseEventdoesn't make sense because it's a websockets things, something node doesn't support natively.regseb commentedon Feb 28, 2023
I thought WebSockets were implemented in Node. I use mock-socket which automatically adds the
WebSocketclass to the global scope, but notCloseEvent.I agree to add
CloseEventwhen Node will supportWebSocket. There is already an issue #19308 for adding WebSockets. And nodejs/undici#1795 already implements it, but it doesn't exportCloseEventhttps://github.com/nodejs/undici/pull/1795/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346:bnoordhuis commentedon Mar 1, 2023
I'll close this then. It's something we can revisit if and when node implements websockets.