este icon indicating copy to clipboard operation
este copied to clipboard

Polyfill Promise only for IE

Open steida opened this issue 11 years ago • 4 comments

I think it's right time to polyfill Promise. http://caniuse.com/#search=promise

steida avatar Nov 19 '15 02:11 steida

import Bluebird from 'bluebird';
// Node
global.Promise = Bluebird;
// Browser
window.Promise = Bluebird;

Is it as simple as this?

XeeD avatar Nov 19 '15 07:11 XeeD

I would rather use native Promise where available. There are some trade-offs, need to rethink it.

steida avatar Nov 19 '15 14:11 steida

I spent hours and hours because I used native Promise instead of Bluebird. The basic error reporting is very bad, at least in Chrome.

XeeD avatar Nov 19 '15 14:11 XeeD

That's good to know. Also, we want to have the same implementation everywhere to ensure the same behavior. And https://github.com/angular/angular.js/issues/6697#issuecomment-42771111 and https://github.com/petkaantonov/bluebird/issues/217

Overriding globals seems to be weird for me, so, I suggest to use plain old import Promise, because that's just works.

steida avatar Nov 19 '15 14:11 steida