Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider any-promise. #3

Open
jamestalmage opened this issue May 4, 2016 · 5 comments
Open

Consider any-promise. #3

jamestalmage opened this issue May 4, 2016 · 5 comments

Comments

@jamestalmage
Copy link

I'm really impressed with it. However, it throws on Node <= 0.12 if an implementation is not registered.

It might be interesting to make pinkie-promise a wrapper around any-promise that loads pinkie instead of throwing. Like any-promise, but it always gives you a promise implementation.

@floatdrop
Copy link
Owner

Why? If you need specific implementation, you can do global.Promise = require('bluebird'); in you application.

@jamestalmage
Copy link
Author

any-promise offers any-promise/implementation (returns a string identifying which implementation was loaded). You can create optimized code paths based on that.

It has a well tested solution for browsers.

It avoids global.Promise on 0.12 (because it had problems? I don't know what they were).

Finally, it's just become a hugely popular way to provide customizeable Promise implementations.

@floatdrop
Copy link
Owner

You can create optimized code paths based on that.

@jamestalmage in readme they say opposite thing – you should not optimize your module code based on specific implementation.

From my point of view – best way to customize Promise implementation in application is to set global Promise object. I honestly do not see point of switching on it.

@sindresorhus
Copy link
Contributor

I don't think it's worth doing a breaking change here at this point. Node.js 0.12 is out of active LTS anyways. So it's going away.

@jamestalmage
Copy link
Author

Last argument. any-promise protects against multiple attempts to set the implementation, something you can't do with globals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants