Rename PDFPageProxy.pageInfo
to PDFPageProxy._pageInfo
to indicate that the property should be considered "private"
Since `PDFPageProxy` already provide getters for all the data returned by `GetPage` (in the Worker), there isn't any compelling reason for accessing the `pageInfo` directly on `PDFPageProxy`. The patch also changes the `GetPage` handler, in `src/core/worker.js`, to use modern JavaScript features.
This commit is contained in:
parent
4f4b50e01e
commit
b263b702e8
@ -639,19 +639,17 @@ var WorkerMessageHandler = {
|
||||
|
||||
handler.on('GetPage', function wphSetupGetPage(data) {
|
||||
return pdfManager.getPage(data.pageIndex).then(function(page) {
|
||||
var rotatePromise = pdfManager.ensure(page, 'rotate');
|
||||
var refPromise = pdfManager.ensure(page, 'ref');
|
||||
var userUnitPromise = pdfManager.ensure(page, 'userUnit');
|
||||
var viewPromise = pdfManager.ensure(page, 'view');
|
||||
|
||||
return Promise.all([
|
||||
rotatePromise, refPromise, userUnitPromise, viewPromise
|
||||
]).then(function(results) {
|
||||
pdfManager.ensure(page, 'rotate'),
|
||||
pdfManager.ensure(page, 'ref'),
|
||||
pdfManager.ensure(page, 'userUnit'),
|
||||
pdfManager.ensure(page, 'view'),
|
||||
]).then(function([rotate, ref, userUnit, view]) {
|
||||
return {
|
||||
rotate: results[0],
|
||||
ref: results[1],
|
||||
userUnit: results[2],
|
||||
view: results[3],
|
||||
rotate,
|
||||
ref,
|
||||
userUnit,
|
||||
view,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
@ -831,7 +831,7 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
|
||||
var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
function PDFPageProxy(pageIndex, pageInfo, transport, pdfBug = false) {
|
||||
this.pageIndex = pageIndex;
|
||||
this.pageInfo = pageInfo;
|
||||
this._pageInfo = pageInfo;
|
||||
this.transport = transport;
|
||||
this._stats = (pdfBug ? new StatTimer() : DummyStatTimer);
|
||||
this._pdfBug = pdfBug;
|
||||
@ -853,27 +853,27 @@ var PDFPageProxy = (function PDFPageProxyClosure() {
|
||||
* @return {number} The number of degrees the page is rotated clockwise.
|
||||
*/
|
||||
get rotate() {
|
||||
return this.pageInfo.rotate;
|
||||
return this._pageInfo.rotate;
|
||||
},
|
||||
/**
|
||||
* @return {Object} The reference that points to this page. It has 'num' and
|
||||
* 'gen' properties.
|
||||
*/
|
||||
get ref() {
|
||||
return this.pageInfo.ref;
|
||||
return this._pageInfo.ref;
|
||||
},
|
||||
/**
|
||||
* @return {number} The default size of units in 1/72nds of an inch.
|
||||
*/
|
||||
get userUnit() {
|
||||
return this.pageInfo.userUnit;
|
||||
return this._pageInfo.userUnit;
|
||||
},
|
||||
/**
|
||||
* @return {Array} An array of the visible portion of the PDF page in the
|
||||
* user space units - [x1, y1, x2, y2].
|
||||
*/
|
||||
get view() {
|
||||
return this.pageInfo.view;
|
||||
return this._pageInfo.view;
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user