node-challonge icon indicating copy to clipboard operation
node-challonge copied to clipboard

Promises?

Open Tidwell opened this issue 7 years ago • 3 comments

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:

  • callback object property
  • callback function as second argument
  • promise chaining

Tidwell avatar Mar 15 '17 02:03 Tidwell

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

eaaliprantis avatar Mar 17 '17 00:03 eaaliprantis

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.

Tidwell avatar Mar 19 '17 22:03 Tidwell

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

eaaliprantis avatar Mar 23 '17 05:03 eaaliprantis