Skip to content

allow user to pick a promise lib #766

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

Closed
jchip opened this issue Apr 28, 2016 · 4 comments
Closed

allow user to pick a promise lib #766

jchip opened this issue Apr 28, 2016 · 4 comments

Comments

@jchip
Copy link

jchip commented Apr 28, 2016

Having this module explicitly depend on Q is an inconvenience when user doesn't want to use Q. The browser version also packs a copy of Q, even if we don't want to use Promise or want to use another Promise polyfill.

Would you consider removing explicit dependence on any specific Promise implementation, and allow user to supply a polyfill?

Some ideas:

  • expose a swaggerClient.Promise that user can set but assign global Promise to it by default.
  • If Promise is not defined, then throw error if usePromise is true.

Q.defer can be implemented using the ES6 Promise:

function defer() {
  var deferred = {};
  deferred.promise = new Promise(function (resolve, reject) {
    deferred.resolve = resolve;
    deferred.reject = reject;
  });

  return deferred;
};

This change would require a major version bump.

@fehguy
Copy link
Contributor

fehguy commented May 3, 2016

We're working on this for the next version.

@mbana
Copy link

mbana commented May 16, 2016

Thanks. Would be nice to use this https://github.com/stefanpenner/es6-promise.

@fehguy fehguy added this to the future milestone Jul 12, 2016
@sebinsua
Copy link

The best way of doing this is with: any-promise

@fehguy
Copy link
Contributor

fehguy commented Mar 27, 2017

This has been done in the 3.x version.

@fehguy fehguy closed this as completed Mar 27, 2017
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

4 participants