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

Set the promise dependency #250

Closed
reconbot opened this issue Dec 19, 2016 · 2 comments
Closed

Set the promise dependency #250

reconbot opened this issue Dec 19, 2016 · 2 comments

Comments

@reconbot
Copy link
Contributor

reconbot commented Dec 19, 2016

I've got a few applications that have chosen to use bluebird everywhere instead of the native promises. We're able to wrap libraries or set the promise dependencies. We avoid global scopes as our code isn't always running in node and I don't want to pollute the scope. Would you be opposed to a PR that lets people set the promise dependency inside got?

Something like;

const got = require('got')
const bluebird = require('bluebird')
got(url, {promise: bluebird})

or if not per request at least for all of got

const got = require('got')
got.Promise = require('bluebird')
got(url)
@julien-f
Copy link
Contributor

I don't think it's a good idea to start exposing this kind of option.
And it work for nested use of got.

IMHO, at the application level it's better to simply set Promise to Bluebird.

@sindresorhus
Copy link
Owner

Not something we're interested in exposing, no. You also can't realistically ask every dependency you use to expose such option. Either override global.Promise or Bluebird.resolve(got()). Or you could use a Babel plugin: https://github.com/59naga/babel-plugin-transform-bluebird

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