mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
[api-minor] Refactor the annotation code to be asynchronous
This commit is the first step towards implementing parsing for the appearance streams of annotations. Co-authored-by: Jonas Jenwald <jonas.jenwald@gmail.com> Co-authored-by: Tim van der Meij <timvandermeij@gmail.com>
This commit is contained in:
parent
c8ee63319d
commit
3741becb9b
4 changed files with 482 additions and 432 deletions
|
@ -26,13 +26,25 @@ import { Stream } from './stream';
|
|||
|
||||
class AnnotationFactory {
|
||||
/**
|
||||
* Create an `Annotation` object of the correct type for the given reference
|
||||
* to an annotation dictionary. This yields a promise that is resolved when
|
||||
* the `Annotation` object is constructed.
|
||||
*
|
||||
* @param {XRef} xref
|
||||
* @param {Object} ref
|
||||
* @param {PDFManager} pdfManager
|
||||
* @param {Object} idFactory
|
||||
* @returns {Annotation}
|
||||
* @return {Promise} A promise that is resolved with an {Annotation} instance.
|
||||
*/
|
||||
static create(xref, ref, pdfManager, idFactory) {
|
||||
return pdfManager.ensure(this, '_create',
|
||||
[xref, ref, pdfManager, idFactory]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
static _create(xref, ref, pdfManager, idFactory) {
|
||||
let dict = xref.fetchIfRef(ref);
|
||||
if (!isDict(dict)) {
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue