1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 01:58:06 +02:00

Replace unnecessary bind(this) and var self = this statements with arrow functions in remaining src/core/ files

This commit is contained in:
Jonas Jenwald 2017-05-02 11:14:53 +02:00
parent 0c99429291
commit ebaa22478c
5 changed files with 47 additions and 68 deletions

View file

@ -417,20 +417,17 @@ var Annotation = (function AnnotationClosure() {
},
loadResources: function Annotation_loadResources(keys) {
return new Promise(function (resolve, reject) {
this.appearance.dict.getAsync('Resources').then(function (resources) {
if (!resources) {
resolve();
return;
}
var objectLoader = new ObjectLoader(resources.map,
keys,
resources.xref);
objectLoader.load().then(function() {
resolve(resources);
}, reject);
}, reject);
}.bind(this));
return this.appearance.dict.getAsync('Resources').then((resources) => {
if (!resources) {
return;
}
var objectLoader = new ObjectLoader(resources.map,
keys,
resources.xref);
return objectLoader.load().then(function() {
return resources;
});
});
},
getOperatorList: function Annotation_getOperatorList(evaluator, task,
@ -454,15 +451,14 @@ var Annotation = (function AnnotationClosure() {
var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1];
var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0];
var transform = getTransformMatrix(data.rect, bbox, matrix);
var self = this;
return resourcesPromise.then(function(resources) {
return resourcesPromise.then((resources) => {
var opList = new OperatorList();
opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]);
return evaluator.getOperatorList(self.appearance, task,
resources, opList).then(function () {
return evaluator.getOperatorList(this.appearance, task,
resources, opList).then(() => {
opList.addOp(OPS.endAnnotation, []);
self.appearance.reset();
this.appearance.reset();
return opList;
});
});