@@ -214,16 +214,10 @@ /** Prepend context to the start of the next diff chunk. */ NextUp: -1, /** Process the next queued action. */ ProcessQueue: 0x7fffffff }, - config: { - /* - glyphUp: '⇡', //'&#uarr;', - glyphDown: '⇣' //'&#darr;' - */ - }, /** Creates and returns a button element for fetching a chunk in the given fetchType (as documented for fetchChunk()). */ @@ -527,21 +521,23 @@ if(fetchType===this.FetchType.NextUp && !this.pos.next || fetchType===this.FetchType.PrevDown && !this.pos.prev){ console.error("Attempt to fetch diff lines but don't have any."); return this; } - this.msg(false); + this.msg(false,"Fetching diff chunk..."); + const self = this; const fOpt = { urlParams:{ name: this.fileHash, from: 0, to: 0 }, + aftersend: ()=>this.msg(false), onload: function(list){ - this.injectResponse(fetchType,up,list); - if( !this.$fetchQueue || this.$fetchQueue.length==0 ) return; - this.$fetchQueue.shift(); - setTimeout(this.fetchChunk.bind(this,this.FetchType.ProcessQueue)); - }.bind(this) + self.injectResponse(fetchType,up,list); + if( !self.$fetchQueue || self.$fetchQueue.length==0 ) return; + self.$fetchQueue.shift(); + setTimeout(self.fetchChunk.bind(self,self.FetchType.ProcessQueue)); + } }; const up = fOpt.urlParams; if(fetchType===this.FetchType.FillGap){ /* Easiest case: filling a whole gap. */ up.from = this.pos.startLhs; @@ -572,13 +568,13 @@ fetchType = this.FetchType.FillGap; } } //console.debug("fetchChunk(",fetchType,")",up); fOpt.onerror = function(err){ - this.msg(true,err.message); - this.$fetchQueue = []; - }.bind(this); + self.msg(true,err.message); + self.$fetchQueue = []; + }; Diff.fetchArtifactChunk(fOpt); return this; } };