core-js icon indicating copy to clipboard operation
core-js copied to clipboard

`EventTarget`

Open make-github-pseudonymous-again opened this issue 3 years ago • 10 comments

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.

zloirock avatar Jan 14 '22 11:01 zloirock

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

joshxyzhimself avatar Aug 14 '22 13:08 joshxyzhimself

We still need this?

I'm thinking about do some research on this one

ologbonowiwi avatar May 25 '23 00:05 ologbonowiwi

Yes, it's still required and can be useful for some other features.

zloirock avatar May 25 '23 01:05 zloirock

Which node version do we need to cover @zloirock?

ologbonowiwi avatar May 27 '23 14:05 ologbonowiwi

All possible.

zloirock avatar May 28 '23 09:05 zloirock

EventTarget API Specification: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget Implementation example found on stack overflow: https://stackoverflow.com/a/51982980

ologbonowiwi avatar Jun 19 '23 00:06 ologbonowiwi

~~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 -)

zloirock avatar Jul 02 '23 04:07 zloirock

A nice implementation: https://github.com/mysticatea/event-target-shim

cristian-atehortua avatar Aug 14 '23 16:08 cristian-atehortua