Git Product home page Git Product logo

Comments (9)

WebReflection avatar WebReflection commented on July 1, 2024

that's already the case:
https://github.com/WebReflection/event-target/blob/master/esm/index.js#L5-L7

the EventTarget is tested if it can be used as constructor. If not, it's polyfilled.

from event-target.

medikoo avatar medikoo commented on July 1, 2024

Sorry, didn't notice. Great to see that

from event-target.

medikoo avatar medikoo commented on July 1, 2024

I was blind for that, probably because then I expected it to be separate modules.

At least in CJS world, you may require a ponyfill conditionally as e.g. here

Still that's obviously not doable with ESM

from event-target.

WebReflection avatar WebReflection commented on July 1, 2024

this is a polyfll ... the real use case for polyflls is to be used ... as polyfill, so that you can remove the script without bothering dependencies once the time is right.

All you need to really do here is:

<script src="https://unpkg.com/event-target"></script>

that's it, modules are there only for convenience.

from event-target.

medikoo avatar medikoo commented on July 1, 2024

It's one of hundreds of modules to be used by app. Do you recommend listing hundreds of script elements in main HTML file?

Also I tend to not prepare different script/html per each browser. Therefore it's good to have logic that loads polyfill conditionally directly in a code.

from event-target.

WebReflection avatar WebReflection commented on July 1, 2024

Do you recommend listing hundreds of script elements in main HTML file?

I've never used hundreds polyflls, maximum 4 or 5, not a big deal

it's good to have logic that loads polyfill conditionally directly in a code.

your suggestion doesn't make this polyfill conditional

I am really without time for this. This is 100% code covered polyfill for any env. You have options, you can also send PR.

I don't have time for any of these requests, this module is nearly perfect to me already.

from event-target.

medikoo avatar medikoo commented on July 1, 2024

I've never used hundreds polyflls, maximum 4 or 5, not a big deal

I want to use it as ponyfil, so as a regular module and not something that's loaded externally with side effect of changing global environment.

from event-target.

WebReflection avatar WebReflection commented on July 1, 2024

there are no side effects here because the global is unusable in any other way

feel free to look elsewhere, I'm closing this conversation.

from event-target.

WebReflection avatar WebReflection commented on July 1, 2024

also:
https://github.com/WebReflection/event-target/blob/master/cjs/index.js#L4-L9

this is a pony fill for CommonJS and ESM

there are no side effects at all

from event-target.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.