Make sure you use an asynchronous request, since a synchronous request blocks the browser (which explains the GUI blocking).
If this is not your problem, I think you need something like this task queue.
var queue = []; queue.push(someTaskFunction); queue.push(anotherTaskFunction); // ... var runQueue = (function () { var len = queue.length, task = 0; for (; task < len; task++) { yield queue[task](); } }());
Call runQueue.next() to complete the following task. Wrap it in a try..catch file as such:
try { runQueue.next(); } catch (e if (e instanceof StopIteration)) {}
Eli gray
source share