stefanpenner / es6-promise

A polyfill for ES6-style Promises
MIT License
7.3k stars 593 forks source link

Missing polyfill for Promise.allSettled #354

Open codeworrior opened 4 years ago

codeworrior commented 4 years ago

Now that Promise.allSettled reached stage 4 of the specification process, would it make sense to add a polyfill for it to this project?

Or would you rather recommend to add a separate shim for it, something like es-shims/Promise.allSettled ? IMO that's less convenient, but creating yet another implementation also sounds wrong.

andreyvolokitin commented 4 years ago

I just checked the bundle size for es-shims/Promise.allSettled and it's 31.5 kB (es6-promise is 6.2 kB). I'm not sure if it will weight less if reimplemented here, but the bundle size of es-shims/Promise.allSettled was definitely the reason I didn't use it in my project

stefanpenner commented 4 years ago

Wow thats pretty large.

triskweline commented 3 years ago

The reason why es-shims/Promise.allSettled has such a huge bundle size is that they're bundling a lot of dependencies.

Here is a polyfill in 218 bytes.

Would love to see this in es6-promise, which is my favorite promise polyfill :heart:

stefanpenner commented 2 years ago

This project is named es6-promise, and es6 doesn't have all-settled, or other new features.

If there is enough demand, we can create a different polyfil. But it is unclear if adding it here, given the name, makes sense.

Thoughts?

andreyvolokitin commented 2 years ago

I don't think much people rely on the fact that ES2015 doesn't contain allSettled. I personally expect from a polyfill a "full support" (whatever this could mean). But overall can't judge if the name is a deciding factor in this situation. A different polyfill definitely wouldn't hurt, but it could be a split effort for almost same thing.

I guess changing this project name isn't an option?

triskweline commented 2 years ago

As a long-time user of this package, it never occured to me that it its features could be scoped to ES2015. I guess it's because we've been using "ES6" as an inaccurate alias for "the time when we got new JavaScript features" for so long.

In any case, other packages I use have started to use allSettled, and they rarely make the destinction between ES levels. They just assume window.Promise is supported with the current promise features. If this package would remain scoped to ES2015, I could no longer use it as an effective IE11 polyfill.

WormGirl commented 2 years ago

I implemented this method https://github.com/WormGirl/core-promise