1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Dispatch a metadataloaded event once the PDFViewerApplication._initializeMetadata method is done

This will be useful in the following patch, and note that there's also an old issue (see 5765) which asked for such an event. However, given that the use-case wasn't *clearly* specified, and that we didn't have an internal use for it at the time it wasn't implemented.

Also, ensure that all of the metadata-related properties are actually reset when the document is closed.
This commit is contained in:
Jonas Jenwald 2020-12-06 12:30:33 +01:00
parent c549069ebd
commit f8ea83609f

View file

@ -248,7 +248,9 @@ const PDFViewerApplication = {
url: "",
baseUrl: "",
externalServices: DefaultExternalServices,
_boundEvents: {},
_boundEvents: Object.create(null),
documentInfo: null,
metadata: null,
contentDispositionFilename: null,
triggerDelayedFallback: null,
_saveInProgress: false,
@ -789,6 +791,8 @@ const PDFViewerApplication = {
this.downloadComplete = false;
this.url = "";
this.baseUrl = "";
this.documentInfo = null;
this.metadata = null;
this.contentDispositionFilename = null;
this.triggerDelayedFallback = null;
this._saveInProgress = false;
@ -1652,6 +1656,8 @@ const PDFViewerApplication = {
generator: generatorId,
formType,
});
this.eventBus.dispatch("metadataloaded", { source: this });
},
/**