question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

polyfill() does not polyfill Promise.prototype.finally() if the environment already has a Promise implementation.

See original GitHub issue

In polyfill.js, observe line 30: https://github.com/stefanpenner/es6-promise/blob/master/lib/es6-promise/polyfill.js#L30

As I understand it, if a Promise implementation is found on the global object, then the polyfill will use the global object’s Promise implementation as-is, not augmenting it with the stage 4 ES9/ES2018 feature proposal provided in this library, Promise.prototype.finally().

Is this intended behaviour, or a bug? Surely if I have polyfilled es6-promise, I should be getting at least all the advertised features of es6-promise?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:9
  • Comments:6

github_iconTop GitHub Comments

1reaction
shirakabacommented, Jun 19, 2018

@YurySolovyov require('es6-promise/auto') is just an alias for require('es6-promise').polyfill(), so this issue affects both usages.

0reactions
Montanacommented, Apr 5, 2019

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add a polyfill to support finally() in Edge?
A finally callback will not receive any argument, since there's no reliable means of determining if the promise was fulfilled or rejected.
Read more >
Source: util/es6-promise.js - NASA WorldWind
@overview es6-promise - a tiny implementation of Promises/A+. ... function useSetTimeout() {; // Store setTimeout reference so es6-promise will be ...
Read more >
Usage Guide - Babel.js
This guide will show you how to compile your JavaScript application code that uses ES2015+ syntax into code that works in current browsers....
Read more >
Javascript – How to add a polyfill to support finally() in Edge ...
However the finally() method does not work in MS Edge. ... test('native'); // force Promise to use the polyfill implementation Promise.prototype.finally ...
Read more >
es6-promise | Yarn - Package Manager
This is a polyfill of the ES6 Promise. The implementation is a subset of rsvp.js extracted by @jakearchibald, if you're wanting extra features...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found