Call the reset() methods in the PDFAttachmentViewer and PDFOutlineViewer constructors

Rather than duplicating initialization code, we can just call `this.reset()` instead (which is also similar to other existing code, e.g. `PDFViewer`). This will also help ensure that the DOM is completely reset, before any outline items or attachments are displayed.
This commit is contained in:
Jonas Jenwald 2017-08-14 12:34:24 +02:00
parent 3a017b4317
commit 96fb0c0370
2 changed files with 4 additions and 6 deletions

View File

@ -35,13 +35,12 @@ class PDFAttachmentViewer {
* @param {PDFAttachmentViewerOptions} options
*/
constructor({ container, eventBus, downloadManager, }) {
this.attachments = null;
this.container = container;
this.eventBus = eventBus;
this.downloadManager = downloadManager;
this._renderedCapability = createPromiseCapability();
this.reset();
this.eventBus.on('fileattachmentannotation',
this._appendAttachment.bind(this));
}

View File

@ -36,12 +36,11 @@ class PDFOutlineViewer {
* @param {PDFOutlineViewerOptions} options
*/
constructor({ container, linkService, eventBus, }) {
this.outline = null;
this.lastToggleIsShow = true;
this.container = container;
this.linkService = linkService;
this.eventBus = eventBus;
this.reset();
}
reset() {