My durandal based SPA makes various async ajax calls in the activate function of the viewmodels. I am returning a promise using Q from the activate function.
function activate(){
return Q.fcall(['getPersons', 'getAgenda']);
}
function getPersons(){
var defer = Q.defer();
$.ajax({
//omitting most of the settings
success: function(data){
defer.resolve(data);
},
error: function(xhr, status){
defer.reject(status);
}
});
return defer.promise;
}
Similar code exists in the getAgenda function too. All this works fine and my screen transitions in. The trouble is, my getAgenda takes a while (2 to 3 seconds). The splash screen does not appear, the screen stays where it was for the 2 or 3 seconds before transitioning in.
my splash screen is simple and does show the very first time the site loads. Any ideas?