I have a async function that should not execute another async request until the previous one has been finished.
pendingCatalogRequest = WinJS.Promise.as();
loadCatalogAsync = function(name) {
var loadAsync = function() {
return getXmlAsync("catalogdata/" + name);
}
return pendingCatalogRequest = pendingCatalogRequest.then(loadAsync, loadAsync);
}
Is this the correct way to handle this? Or am I missing something?
Will the loadAsync
closure garbage collected when the loadCatalogAsync
function is left?