Remove unnecessary startedTextExtraction
member variable from the find controller
The find controller already has quite a lot of state to maintain. We can avoid keeping track of this member variable because when the find controller is reset, so is the extract text promises array. Therefore, we can just check if that array contains items or not to determine if text extraction already started. Moreover, there is no need to reset the `pageContents` array since the `reset` method already takes care of that.
This commit is contained in:
parent
21d959bb82
commit
a859f0eafd
@ -62,7 +62,6 @@ class PDFFindController {
|
||||
}
|
||||
|
||||
reset() {
|
||||
this.startedTextExtraction = false;
|
||||
this.extractTextPromises = [];
|
||||
this.pendingFindMatches = Object.create(null);
|
||||
this.active = false; // If active, find results will be highlighted.
|
||||
@ -309,11 +308,10 @@ class PDFFindController {
|
||||
}
|
||||
|
||||
_extractText() {
|
||||
if (this.startedTextExtraction) {
|
||||
// Perform text extraction once if this method is called multiple times.
|
||||
if (this.extractTextPromises.length > 0) {
|
||||
return;
|
||||
}
|
||||
this.startedTextExtraction = true;
|
||||
this.pageContents.length = 0;
|
||||
|
||||
let promise = Promise.resolve();
|
||||
for (let i = 0, ii = this.pdfViewer.pagesCount; i < ii; i++) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user