mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-29 15:47:57 +02:00
Use createPromiseCapability
in /web
files
In various viewer files, there's a number of cases where we basically duplicate the functionality of `createPromiseCapability` manually. As far as I can tell, a couple of these cases have existed for a very long time, and notable even before the `createPromiseCapability` utility function existed. Also, since we can write ES6 code now, the patch also replaces a couple of `bind` usages with arrow functions in code that's touched in the patch.
This commit is contained in:
parent
c6e8ca863e
commit
b0a4f6de8f
6 changed files with 62 additions and 83 deletions
|
@ -81,9 +81,9 @@ var PDFFindController = (function PDFFindControllerClosure() {
|
|||
this.dirtyMatch = false;
|
||||
this.findTimeout = null;
|
||||
|
||||
this.firstPagePromise = new Promise(function (resolve) {
|
||||
this._firstPagePromise = new Promise((resolve) => {
|
||||
this.resolveFirstPage = resolve;
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
|
||||
normalize: function PDFFindController_normalize(text) {
|
||||
|
@ -277,7 +277,7 @@ var PDFFindController = (function PDFFindControllerClosure() {
|
|||
this.state = state;
|
||||
this.updateUIState(FindStates.FIND_PENDING);
|
||||
|
||||
this.firstPagePromise.then(function() {
|
||||
this._firstPagePromise.then(function() {
|
||||
this.extractText();
|
||||
|
||||
clearTimeout(this.findTimeout);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue