UPDATE: The problem I am having stems from something entirely different, I would delete the question alltogether but since there are answers, I am not allowed to. /OP
I have a script that is very complex and hard to distill, but here is the essence of what I am doing:
var modulesCount = 4;
// setup the modules object
for (var i = 1; i <= modulesCount; i++) {
composeModule(i);
}
I have some strange behaviour, where is seems every call to the function composeModule()
isn't made, so I figured, will I have to use a setTimeout
in order to split the thread into say 4 different threads like this? Say like this:
// setup the modules object
for (var i = 1; i <= modulesCount; i++) {
setTimeout(function() {
composeModule(i);
}, 1);
}
------------------- UPDATE
Tried this
var c = 1;
for (var i=1;i<=modulesCount;i++) {
console.error('actual count is: '+c+' while variable i is: '+i);
self.composeModule(i,initialCall);
c++;
}
to check if there is a problem with my variable i but it is identic to c in every console output. Or did I misunderstand you guys'es point entirely?