mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-10 10:15:37 +02:00
Minor clean up.
This commit is contained in:
parent
7c35f10af8
commit
07fc34551d
1 changed files with 10 additions and 19 deletions
29
src/api.js
29
src/api.js
|
@ -79,7 +79,7 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||||
function PDFPageProxy(pageInfo, transport) {
|
function PDFPageProxy(pageInfo, transport) {
|
||||||
this.pageInfo = pageInfo;
|
this.pageInfo = pageInfo;
|
||||||
this.transport = transport;
|
this.transport = transport;
|
||||||
this._stats = new StatTimer();
|
this.stats = new StatTimer();
|
||||||
this.objs = transport.objs;
|
this.objs = transport.objs;
|
||||||
}
|
}
|
||||||
PDFPageProxy.prototype = {
|
PDFPageProxy.prototype = {
|
||||||
|
@ -89,9 +89,6 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||||
get rotate() {
|
get rotate() {
|
||||||
return this.pageInfo.rotate;
|
return this.pageInfo.rotate;
|
||||||
},
|
},
|
||||||
get stats() {
|
|
||||||
return this._stats;
|
|
||||||
},
|
|
||||||
get ref() {
|
get ref() {
|
||||||
return this.pageInfo.ref;
|
return this.pageInfo.ref;
|
||||||
},
|
},
|
||||||
|
@ -124,12 +121,12 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var callback = (function complete(error) {
|
function complete(error) {
|
||||||
if (error)
|
if (error)
|
||||||
promise.reject(error);
|
promise.reject(error);
|
||||||
else
|
else
|
||||||
promise.resolve();
|
promise.resolve();
|
||||||
});
|
};
|
||||||
|
|
||||||
// Once the operatorList and fonts are loaded, do the actual rendering.
|
// Once the operatorList and fonts are loaded, do the actual rendering.
|
||||||
this.displayReadyPromise.then(
|
this.displayReadyPromise.then(
|
||||||
|
@ -137,19 +134,13 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||||
var gfx = new CanvasGraphics(renderContext.canvasContext,
|
var gfx = new CanvasGraphics(renderContext.canvasContext,
|
||||||
this.objs, renderContext.textLayer);
|
this.objs, renderContext.textLayer);
|
||||||
try {
|
try {
|
||||||
this.display(gfx, renderContext.viewport, callback);
|
this.display(gfx, renderContext.viewport, complete);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (callback)
|
complete(e);
|
||||||
callback(e);
|
|
||||||
else
|
|
||||||
error(e);
|
|
||||||
}
|
}
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
function pageDisplayReadPromiseError(reason) {
|
function pageDisplayReadPromiseError(reason) {
|
||||||
if (callback)
|
complete(reason);
|
||||||
callback(reason);
|
|
||||||
else
|
|
||||||
error(reason);
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue