Update {PDFLinkService, PDFDocumentProperties}.setDocument
to make the "url" parameter optional
This way the resetting of `PDFLinkService`/`PDFDocumentProperties` instances, as is done in `PDFViewerApplication.close`, only requires passing in *one* `null` argument instead of two.
This commit is contained in:
parent
b40fb3814a
commit
6da78bcc3f
@ -595,8 +595,8 @@ let PDFViewerApplication = {
|
||||
|
||||
this.pdfThumbnailViewer.setDocument(null);
|
||||
this.pdfViewer.setDocument(null);
|
||||
this.pdfLinkService.setDocument(null, null);
|
||||
this.pdfDocumentProperties.setDocument(null, null);
|
||||
this.pdfLinkService.setDocument(null);
|
||||
this.pdfDocumentProperties.setDocument(null);
|
||||
}
|
||||
this.store = null;
|
||||
this.isInitialViewSet = false;
|
||||
|
@ -120,7 +120,7 @@ class PDFDocumentProperties {
|
||||
return Promise.all([
|
||||
info,
|
||||
metadata,
|
||||
contentDispositionFilename || getPDFFileNameFromURL(this.url),
|
||||
contentDispositionFilename || getPDFFileNameFromURL(this.url || ''),
|
||||
this._parseFileSize(this.maybeFileSize),
|
||||
this._parseDate(info.CreationDate),
|
||||
this._parseDate(info.ModDate),
|
||||
@ -187,7 +187,7 @@ class PDFDocumentProperties {
|
||||
* @param {Object} pdfDocument - A reference to the PDF document.
|
||||
* @param {string} url - The URL of the document.
|
||||
*/
|
||||
setDocument(pdfDocument, url) {
|
||||
setDocument(pdfDocument, url = null) {
|
||||
if (this.pdfDocument) {
|
||||
this._reset();
|
||||
this._updateUI(true);
|
||||
|
@ -49,7 +49,7 @@ class PDFLinkService {
|
||||
this._pagesRefCache = null;
|
||||
}
|
||||
|
||||
setDocument(pdfDocument, baseUrl) {
|
||||
setDocument(pdfDocument, baseUrl = null) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.pdfDocument = pdfDocument;
|
||||
this._pagesRefCache = Object.create(null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user