Added 'endreached' support.

if this is set to true, onLoadmore is not called further
This commit is contained in:
2014-09-22 15:28:44 +05:30
parent 949dcf32f1
commit acccb703fd
+2 -1
View File
@@ -20,6 +20,7 @@ function JobManager(opts){
this.onLoadMore = null; this.onLoadMore = null;
this.onError = null; this.onError = null;
this.isLoadingTakingPlace = false; this.isLoadingTakingPlace = false;
this.endReached = false;
this.runningTasks = 0; this.runningTasks = 0;
} }
/* /*
@@ -85,7 +86,7 @@ JobManager.prototype.$doWork_ = function( cb ){
self.onError(err, task, worker ); self.onError(err, task, worker );
} }
if(self.tasks.length/self.concurrency < self.notifyAt && (!self.isLoadingTakingPlace) ){ if(self.tasks.length/self.concurrency < self.notifyAt && (!self.isLoadingTakingPlace) ){
if( self.onLoadMore ) { if( self.onLoadMore && !self.endReached ) {
self.$onLoadMore(); self.$onLoadMore();
} }
} }