Answer the question
In order to leave comments, you need to log in
js promise how to work in recursion?
The bottom line is, there is a code that uses the RSVP promise module for node js.
promise.then(function(){
(function theFunction(arg){
if (!arg) {
//вот тут надо выйти из рекурсии в следующий then
} else {
theFunction(sdf);
}
}(adsf))
}).then(function(){
// продолжаем жить
})
Answer the question
In order to leave comments, you need to log in
rsvp:Chaining
In the first `then` you create and return another promise, inside which you do your `theFunction` recursion and when you are ready you do a resolve. And so on to the second `then`.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question