6

How to enable finally method support if i'm using babel-polyfill in my project build on React-Redux stack

Strangerliquid
  • 227
  • 2
  • 15
  • What kind of promises are you using? ES2015 ("ES6") promises don't have `finally`, so there's nothing to "enable." If you're using some other kind with a `finally` feature that requires enabling, please say what they are. – T.J. Crowder Nov 19 '16 at 14:22
  • Maybe completely other polyfill like `es6-shim`. Does it provide coverage for React ? – Strangerliquid Nov 19 '16 at 14:23
  • But `babel-polyfill` dosen't implement it. And i search a way to gracefully add this missing feature – Strangerliquid Nov 19 '16 at 14:27
  • @MisterEpic: You're talking about `finally` in regard to `try`/`catch`. The OP is talking about it as a method on promises (sometimes people add it, as `finally` or as `always`). – T.J. Crowder Nov 19 '16 at 14:29
  • Possible duplicate of [ES6 promise settled callback](http://stackoverflow.com/q/32362057/1048572)? – Bergi Nov 19 '16 at 15:19

3 Answers3

4

Actually, now it has a proposal, and it's recently got into Stage-3, WebKit already supports it. Spec compliant shim/polyfill libraries are already available too. We can expect an update from the Promise polyfill library maintainers also.

wintercounter
  • 7,500
  • 6
  • 32
  • 46
1

I believe, the Babel-Polyfill shim uses core-js under the hood, which does support Promise.finally: https://github.com/zloirock/core-js#commonjs

enter image description here

batjko
  • 992
  • 2
  • 13
  • 29
0

The ES6 standard does not support the finally phase of a promise, as T.J. Crowder mentioned in the comments to your question. If you want that kind of support, you might look into promises from a library like RSVP.

kevin628
  • 3,458
  • 3
  • 30
  • 44