stefanpenner / es6-promise

A polyfill for ES6-style Promises
MIT License
7.29k stars 594 forks source link

Incompatible with angular2 #224

Closed raiju closed 8 years ago

raiju commented 8 years ago

Hey,

I'm building an app using angular2, and hit a problem when I included a library using this shim. Angular2 overrides the browser's Promise with its own implementation (ZoneAwarePromise). This causes a problem in https://github.com/stefanpenner/es6-promise/blob/master/lib/es6-promise/polyfill.js#L21, where the toString returns [object Function] instead of [object Promise].

This causes the polyfill to trigger even though there was a Promise implementation available. Would it be possible to weaken the check to accept non-native Promise implementations? (I can make a PR, just want to make sure you're ok with this change before-hand).

(Currently have a workaround in place in my code: store the Promise object in a variable before including the external library, and restore it afterwards)

stefanpenner commented 8 years ago

will be addressed in 4.0 https://github.com/stefanpenner/es6-promise/pull/230

raiju commented 8 years ago

Thanks!