Replace unnecessary var self = this statements with arrow functions in web/pdf_find_controller.js

This commit is contained in:
Jonas Jenwald 2017-05-10 13:51:36 +02:00
parent c750514903
commit 9efd11c5c9

View File

@ -312,18 +312,17 @@ var PDFFindController = (function PDFFindControllerClosure() {
this.pageMatches = []; this.pageMatches = [];
this.matchCount = 0; this.matchCount = 0;
this.pageMatchesLength = null; this.pageMatchesLength = null;
var self = this;
for (var i = 0; i < numPages; i++) { for (let i = 0; i < numPages; i++) {
// Wipe out any previous highlighted matches. // Wipe out any previous highlighted matches.
this.updatePage(i); this.updatePage(i);
// As soon as the text is extracted start finding the matches. // As soon as the text is extracted start finding the matches.
if (!(i in this.pendingFindMatches)) { if (!(i in this.pendingFindMatches)) {
this.pendingFindMatches[i] = true; this.pendingFindMatches[i] = true;
this.extractTextPromises[i].then(function(pageIdx) { this.extractTextPromises[i].then((pageIdx) => {
delete self.pendingFindMatches[pageIdx]; delete this.pendingFindMatches[pageIdx];
self.calcFindMatch(pageIdx); this.calcFindMatch(pageIdx);
}); });
} }
} }