mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Require destinations when they are needed and do not fetch all of them in advance
This commit is contained in:
parent
fb6d87c77b
commit
b215af30d3
5 changed files with 80 additions and 16 deletions
|
@ -293,10 +293,20 @@ var PDFDocumentProxy = (function PDFDocumentProxyClosure() {
|
|||
/**
|
||||
* @return {Promise} A promise that is resolved with a lookup table for
|
||||
* mapping named destinations to reference numbers.
|
||||
*
|
||||
* This can be slow for large documents: use getDestination instead
|
||||
*/
|
||||
getDestinations: function PDFDocumentProxy_getDestinations() {
|
||||
return this.transport.getDestinations();
|
||||
},
|
||||
/**
|
||||
* @param {string} id The named destination to get.
|
||||
* @return {Promise} A promise that is resolved with all information
|
||||
* of the given named destination.
|
||||
*/
|
||||
getDestination: function PDFDocumentProxy_getDestination(id) {
|
||||
return this.transport.getDestination(id);
|
||||
},
|
||||
/**
|
||||
* @return {Promise} A promise that is resolved with a lookup table for
|
||||
* mapping named attachments to their content.
|
||||
|
@ -1128,6 +1138,10 @@ var WorkerTransport = (function WorkerTransportClosure() {
|
|||
return this.messageHandler.sendWithPromise('GetDestinations', null);
|
||||
},
|
||||
|
||||
getDestination: function WorkerTransport_getDestination(id) {
|
||||
return this.messageHandler.sendWithPromise('GetDestination', { id: id } );
|
||||
},
|
||||
|
||||
getAttachments: function WorkerTransport_getAttachments() {
|
||||
return this.messageHandler.sendWithPromise('GetAttachments', null);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue