-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using triggerPromise I only receive one argument in .then
?
#5
Comments
This isn't possible due to limitations of the Promise API. It only allows one argument in the callbacks. It tried this var removeSuccess = me.completed.listen(function () {
removeSuccess();
removeFailed();
resolve.apply(null, arguments);
}); but only the first argument is defined in the then-callback. |
Actually I believe you can by using arrays and
In order to have the user use the array as arguments they can do either the following:
someAction.triggerPromise(a, b, c)
.spread((d, e, f) => {
console.log(d, e, f);
})
someAction.triggerPromise(a, b, c)
.then(() => {
var { d, e, f } = arguments;
console.log(d, e, f);
}) |
I will try this later |
@spoike @DerNivel thanks for the follow up to this issue! |
@spoike var removeSuccess = me.completed.listen(function () {
var args = Array.prototype.slice.call(arguments);
removeSuccess();
removeFailed();
resolve(args.length > 1 ? args : args[0]);
}); In ES6 this would be possible with the native implementation of Promise: someAction.triggerAsync().then(([obj1, obj2]) => {
// obj1 and obj2 are available
}); If this is okay I'll create a PR. |
@DerNivel 👌 |
#7 fixes this issue |
Other than #7, we also need to:
|
Reported by @ponelat in reflux/refluxjs#416
The text was updated successfully, but these errors were encountered: