You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am confused by the question. The example from the README is to show that you can return any promise.
The way a promise is defined is:
newPromise(function(resolve,reject){});
We aren't going to be passing a resolve and reject function into a task, as we already pass an optional node-style callback into it. The http example you posted is more confusing than showing a newly constructed promise being returned because it is not obvious the library returns promises.
I was looking at your example that returns a promise and was wondering why you would return a promise that way.
What's the use case? Wanting to call reject? If so, something like this seems more elegant and also handles the callback use case.
However, it still does make sense to support promises if you are using a library that returns promises.
I just don't understand why you would ever want to define a promise within a task. Not that big of a deal though.
The text was updated successfully, but these errors were encountered: