I'm working on a script which handles a local/distant synchronisation of files (check/delete/download).
This is working quite fine, but I struggle to know when the tasks are finished. Therefore, I have an incrementation of the tasks to perform.
I would like to do something like this, but I don't know how to code it properly:
function wait(){
setTimeout(function(){
if (fileCount<totalCount){
wait();
}else{
clearTimeout();
taskAreFinished();
}
},100);
}
I know this code is ugly; it's just to share the idea...