I'm writing a promise-based method which takes one parameter and returns an array of values in the next step. Something like this:
foo(a).then(function (arr) {});
Inside my method foo
I'm doing something like this:
foo = function (a) {
...
// this will return my array
function returnArray(my_return_array) {
return RSVP.all(my_return_array).fail(console.log);
}
return requestBundleElements(a)
.then(assembleReturnArray)
.then(returnArray)
.fail(console.log);
};
I'm wondering if it is possible to pass back arguments
instead of an array
by calling apply
. So I could add another step in my promise chain and do:
return requestBundleList(setLoadingOrder(module_list))
.then(assembleReturnArray)
.then(returnArray)
.then(returnArguments)
.fail(console.log);
with:
function returnArguments(my_result_array) {
//... "apply" something here
}
Question:
But as I don't have access to the "next" callback method, I can't apply
. Is there any way to send back a list of parameters instead of an array to the next step?