Closed kevinoid closed 8 years ago
sg
@jakearchibald r?
I will include this as part of 4.0 (hoping to release that this weekend)
Sounds great, thanks!
I had some time this evening and was curious about the behavior of other popular Promise libraries which could serve as polyfills. From some quick investigation, here's what I've found:
Library | Browser Polyfill | Un-Polyfill | Node Polyfill |
---|---|---|---|
bluebird | Unconditional | .noConflict() |
None |
Native Promise Only | If falsy | None | If falsy |
promise | If undefined |
None | None |
Q | None | .noConflict() of Q |
None |
RSVP.js | None | None | None |
when.js | Unconditional from when/es6-shim/Promise only | None | Unconditional from when/es6-shim/Promise only |
vow | None | None | None |
I think the behavior implemented in this PR appears to be similar to the behavior of when.js. I don't have an opinion about whether it is the best behavior. Just thought it was worth considering any established conventions.
@stefanpenner Hey just wanted to check-in on the status of this PR. :smiley:
What's the status on the release of 4.0?
What's the status on the release of 4.0?
When I have time, unfortunately i have been quite busy lately.
@stefanpenner No worries, I know how it goes.
If there are things you feel you can delegate, I'd be glad to lend a hand.
I'll take a look this weekend, and see what can be delegated. I first must restore my memory on this project, so I can remember where i left off.
Sounds good to me.
Didn't mean to rush you, just wanted to know whether or not this PR was still active.
@naoufal would love extra help, so no worries :)
updated for latest build updates: https://github.com/stefanpenner/es6-promise/pull/230
Thanks for updating and merging this PR @stefanpenner! I appreciate the extra effort for making this non-trivial API change. It looks great!
This pull request provides a mechanism for users to load a version of this module which automatically installs the polyfill, separately from the default non-automatic version, as outlined in https://github.com/jakearchibald/es6-promise/pull/126#issuecomment-120542090
It uses
require('es6-promise/auto')
instead ofrequire('es6-promise/polyfill')
so that it does not directly conflict with the es-shim-api API Contract in case support is later added. I'm open to changing this if another name is preferred.In addition to the Node/Browserify file, a UMD file which triggers automatic polyfill installation is also provided.
Thanks for considering, Kevin
Fixes: #140 Alternative-to: #126
Note to reviewer: This commit reduces
dist/es6-promise.min.js
from 18kB to 6.4kB by mangling the names. I'm not sure why the previous commit was not mangled, sincemangle: false
is not passed tobroccoli-uglify-js
, but if it was intentional, I can fix and resubmit.