Fix: no need to assign tasks before initial start of JobManager. tasks are loaded using onLoadmore at start time

This commit is contained in:
2014-09-22 15:24:35 +05:30
parent 971f97e5f5
commit c5db208ab3
+10 -2
View File
@@ -110,14 +110,22 @@ JobManager.prototype.$trigger = function (){
JobManager.prototype.start = function( ) { JobManager.prototype.start = function( ) {
this.state = STATE.RUNNING; this.state = STATE.RUNNING;
this.updateState(); this.updateState();
this.$trigger(); var self = this;
if( this.tasks.length ) {
return this.$trigger();
}
return this.$onLoadMore( function(){
self.$trigger();
});
}; };
JobManager.prototype.$onLoadMore = function(){ JobManager.prototype.$onLoadMore = function( cb ){
cb = cb || function(){};
var self = this; var self = this;
self.isLoadingTakingPlace = true; self.isLoadingTakingPlace = true;
self.onLoadMore(function(){ self.onLoadMore(function(){
self.isLoadingTakingPlace = false; self.isLoadingTakingPlace = false;
return cb();
}); });
}; };