mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
A couple of (small) tweaks of the AnnotationStorage
(PR 12173 follow-up)
- Initialize the `AnnotationStorage`-instance, on `PDFDocumentProxy`, lazily. - Change the `AnnotationStorage` to use a `Map` internally, rather than a regular Object (simplifies the following points). - Let `AnnotationStorage.getAll` return `null` when there's no data stored, to avoid unnecessary parsing on the worker-thread. This ought to "just work", since the worker-thread code *should* already handle the `!annotationStorage` case everywhere. - Add a new `AnnotationStorage.size` getter, to be able to easily tell if there's any data stored.
This commit is contained in:
parent
6620861c7d
commit
4d351eab93
2 changed files with 14 additions and 8 deletions
|
@ -632,14 +632,13 @@ class PDFDocumentProxy {
|
|||
constructor(pdfInfo, transport) {
|
||||
this._pdfInfo = pdfInfo;
|
||||
this._transport = transport;
|
||||
this._annotationStorage = new AnnotationStorage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {AnnotationStorage} Storage for annotation data in forms.
|
||||
*/
|
||||
get annotationStorage() {
|
||||
return this._annotationStorage;
|
||||
return shadow(this, "annotationStorage", new AnnotationStorage());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue