Closed briancavalier closed 9 years ago
:+1:
So, does callbacks.call require the last two arguments exactly to be the node-style callbacks? Or is one enough?
@ceineke The last two arguments should be "normal" callbacks (i.e. each accepts a single parameter), rather than node-style callbacks. They work like the resolve
and reject
parameters passed in the ES6 Promise constructor.
Yes, using a single callback is enough--you can ignore the reject
parameter if you don't need it, just like you can ignore it when using an ES6 Promise constructor or when.promise
. For example, these two are equivalent:
// Declare both resolve and reject as parameters
callbacks.call((x, y, z, resolve, reject) => resolve(x+y+z), 10, 20, 30); // promise for 60
// Don't declare reject because it isn't needed
callbacks.call((x, y, z, resolve) => resolve(x+y+z), 10, 20, 30); // promise for 60
Make sense?
Gotcha. :) :+1:
Fix #460