I'm developing a system using angular and have the following function:
function drawLatLong(i, arrayIdColetor) {
.....
(não exibi o código por ser grande e achar desnecessário que vcs o analisem)
.....
});
This function is invoked in a for:
for(var j = 0; j < $kinvey.arrayIdColetor.length; j++){
drawLatLong(j, $kinvey.arrayIdColetor);
}
The drawLatLong function, which is invoked N times according to FOR, takes a considerable amount of time to execute because it does relatively heavy queries in the database.
The problem I'm having is that if the user invokes another function without the drawLatLong function has ended, the system does not behave as it should.
Would you have any way to keep this situation under control? That is, does it only allow the user to execute another function after the drawLatLong has been finalized? Or would it be possible to break the drawLatLong function in the middle if another function is invoked by the user?
I hope I have been clear. Thanks in advance.