havard / node-openid

OpenID for Node.js
MIT License
293 stars 100 forks source link

Implement Promises #144

Closed cprecioso closed 8 years ago

cprecioso commented 8 years ago

I've been thinking of adapting the API to return Promises in a backwards-compatible manner (check if the callback argument was used and if not, return a Promise), and use them internally. Would this change be accepted?

Also, if that is OK, even async/await functions from ES.next could be used internally in order to dramatically simplify almost all the code in the library (and less code = less possibility of errors).

All of this, obviously in a backwards-compatible manner (in terms of API and the JS engine used), though the async functions would most certainly mean adding a transpiling step.

havard commented 8 years ago

I don't want to introduce any transpilation or tool dependencies unless there is a really good reason to do so. Same thing with promises, I really can't see what we gain from such a change when one can simply wrap the existing API in promises and achieve the exact same effect.

havard commented 8 years ago

No further response, closing.