core-js
core-js copied to clipboard
`EventTarget`
EventTarget
does not exist in Node < 16. Example.
Some existing polyfills:
- https://github.com/benlesh/event-target-polyfill#readme
- https://github.com/mattkrick/event-target-polyfill
I'll think makes it sense or not, thanks.
Note: it is listed as experimental starting with Node 14.5 but I cannot find the flag to enable it (in Node 14.18).
Hi, a bit similar, I was looking for a polyfill of Headers which has long been supported in browsers but just recently in v18 of Node.js. Its API is quite similar to URLSearchParams though.
- https://developer.mozilla.org/en-US/docs/Web/API/Headers
- https://nodejs.org/api/globals.html#class-headers
We still need this?
I'm thinking about do some research on this one
Yes, it's still required and can be useful for some other features.
Which node version do we need to cover @zloirock?
All possible.
EventTarget API Specification: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget Implementation example found on stack overflow: https://stackoverflow.com/a/51982980
~~EventTarget API Specification: developer.mozilla.org/en-US/docs/Web/API/EventTarget~~
EventTarget API Specification: https://dom.spec.whatwg.org/#interface-eventtarget
Implementation example found on stack overflow: stackoverflow.com/a/51982980
It's not the best place to look for polyfills code -)
A nice implementation: https://github.com/mysticatea/event-target-shim