javascript - How to know when a recursive, asynchronous task finishes -


i have async function, can recurse itself.

i'm adding jquery deferreds array each time function runs, use $.when() check if promises have resolved. issue can't seem without arbitary timeout, don't know when function stops recursing , adding new promises.

do push promises synchronously, know when finished. since function recursive , returns promise, can use result promises of recursive calls this. use $.when() results of current recursion level, not promises in call stack.

also check answers understanding promises in node.js recursive function , is there example of using raw q promise library node recursively traverse directory asynchronously? - though they're not using jquery's implementation, should give idea of how it.


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -