stefanpenner / es6-promise

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

Do not polyfill under node.js v4.4.3 #193

Closed tanx closed 8 years ago

tanx commented 8 years ago

Thanks for your useful module. We use it in OpenPGP.js.

The polyfill detection seems to be broken at least under the current node LTS (v4.4.3). See: https://github.com/openpgpjs/openpgpjs/issues/455

I debugged to understand why global.Promise is polyfilled even though node has native support for Promises. I found that Object.prototype.toString.call(P.resolve()) returns '[object Object]' and not '[object Promise]' like in Chrome.

Perhaps there is a broader and more elegant way to fix the issue, but with this patch the native Promise function is no longer overriden in node.

zloirock commented 8 years ago

click me

tanx commented 8 years ago

@zloirock ok, sorry. Forgot to see the open issues. My bad.

Overriding the native Promise still seems to cause problems for our users though. So I guess we will use our fork until this issue is resolved.