Hi All
in a loop I load, via AJAX, a couple of xml files using the same callback function
If all files are loaded my script continues to do other stuff
Basically my callback function does something like (I also use the prototype library)
[code]
MyClass.prototype = {
initialize: function() {…}, // load 10 files via AJAX (callback function is: my_callback)
…..
my_callback: function(file, …) {
this.count ++ ; // an other file loaded
…. do stuff … // at this point an other file might be ready and reach the previous line
if ( this.count == 10 )
this.do_other_stuff() ; // and this function can be called multiple times!!
},
do_other_stuff: function(){….}
}
Do I not need to worry about thread safety in javascript ?
I ask this because I have strange problems at the moment, which might be explained by this. If I do need to worry about this, what would be the best approach in this situation ?
Thnx a lot
LuCa