Tidwell / node-challonge

A node.js wrapper for the challonge.com API
28 stars 9 forks source link

Promises? #17

Open Tidwell opened 7 years ago

Tidwell commented 7 years ago

Or at least allowing callback to be passed as the second argument so that promisfy libraries will work nicely.

This would have to be in a major version bump unless it was done in a backwards-compatible manner.

To be backwards-compat, would require:

eaaliprantis commented 7 years ago

Could we make it an option where legacy could be a boolean (indicating callback = true while promises = false) and the default will be false?

Tidwell commented 7 years ago

If we are going to support everything, we shouldn't need to flag it, just check if the callback property is there, or the final argument to the call is a function, and return a promise from each call.

However, since we need to bump to 2.0 anyway to resolve the challonge-js merge, we might consider just switching to promises anyway for 3.0.

I think I'll mark this as a 3.0 feature for now.

eaaliprantis commented 7 years ago

I would still support both fallback and promises. I would also try and use superagent, which is pretty awesome to use.