Options
All
  • Public
  • Public/Protected
  • All
Menu

Web Publication implementation of IPublication that can be loaded into the Reading System.

To create an instance, use one of the static methods:

  • createFromBlob
  • createFromPrimaryEntryPageUrl
  • createFromManifestUrl
  • createFromRandomAccessDataSource

Hierarchy

  • WpPublication

Implements

Index

Constructors

constructor

Methods

destroy

  • destroy(): void
  • Destroy this instance, allowing used resources to be garbage collected.

    Returns void

getBackingResourceProvider

getCoverImageResourceUrl

  • getCoverImageResourceUrl(): URL
  • Get the URL to the cover image resource declared in this publication, if any.

    To fetch the resource data for this URL, use the IResourceProvider returned by getBackingResourceProvider().

    Returns URL

getDefaultLayout

getHashSignature

  • getHashSignature(): string
  • Get a generated hash signature of the publication, intended to uniquely identify this publication. The hash signature is not the same as the publication id as the hash signature always changes when the publication data changes in any way. The uniqueness of the signature depends on how the publication was loaded. Please refer the implementation responsible for loading this instance. For example, for EPUB see OcfResourceProvider.

    Returns string

getManifest

getMediaType

getMetadata

getNavigationResourceUrl

  • getNavigationResourceUrl(): URL

getPageProgressionDirection

getPreferredFlowMode

getPreferredOrientation

getPreferredSyntheticSpreadBehavior

getProfiles

  • getProfiles(): string[]
  • Get the profile of this publication.

    Profiles are publication formats (e.g., audiobooks) describing what type of contents to expect in the publication and in the manifest data.

    Returns string[]

getSpine

getType

  • Get the type of publication this instance represents.

    This allows you to cast an IPublication instance to a more specific subtype. See PublicationType for how values map to specific IPublication types.

    Returns PublicationType

isDestroyed

  • isDestroyed(): boolean

toJSON

Static createFromBlob

  • Creates a new instance from a blob containing the LPF file.

    Parameters

    • blob: Blob

      The complete LPF file as a blob.

    Returns Promise<IWpPublication>

Static createFromManifestUrl

  • createFromManifestUrl(resourceProvider: IResourceProvider, manifestUrl: string | URL, hashSignature: string, onDestroyed?: () => void): Promise<IWpPublication>
  • Creates a new instance by loading the publication from the specified IResourceProvider instance and publication manifest URL.

    Parameters

    • resourceProvider: IResourceProvider

      The resource provider where to fetch resources from.

    • manifestUrl: string | URL

      An absolute or relative URL identifying the manifest of the publication.

    • hashSignature: string

      A string uniquely identifying this version of the publication. This can for example be a SHA checksum of the publication contents.

    • Optional onDestroyed: () => void

      A function that will be called when WpPublication.destroy() has been called. This allows for cleaning up ResourceProviders etc.

        • (): void
        • Returns void

    Returns Promise<IWpPublication>

Static createFromPrimaryEntryPageUrl

  • createFromPrimaryEntryPageUrl(resourceProvider: IResourceProvider, primaryEntryPageUrl: string | URL, hashSignature: string, onDestroyed?: () => void): Promise<IWpPublication>
  • Creates a new instance by loading the publication from the specified IResourceProvider instance and primary entry page URL.

    Parameters

    • resourceProvider: IResourceProvider

      The resource provider where to fetch resources from.

    • primaryEntryPageUrl: string | URL

      An absolute or relative URL identifying the primary entry page of the publication. See https://www.w3.org/TR/wpub/#primary-entry-page for more information

    • hashSignature: string

      A string uniquely identifying this version of the publication. This can for example be a SHA checksum of the publication contents.

    • Optional onDestroyed: () => void

      A function that will be called when WpPublication.destroy() has been called. This allows for cleaning up ResourceProviders etc.

        • (): void
        • Returns void

    Returns Promise<IWpPublication>

Static createFromRandomAccessDataSource

Static createFromResourceProvider

  • Creates a new instance from a IResourceProvider representing the LPF file container.

    The implementation will look for the Publication Manifest by trying to fetch first publication.json and then index.html.

    Parameters

    • resourceProvider: IResourceProvider

      The resource provider where to fetch resources from.

    • hashSignature: string

      A string uniquely identifying this version of the publication. This can for example be the SHA1 hash of the publication contents.

    • Optional onDestroyed: () => void

      A function that will be called when WpPublication.destroy() has been called. This allows for cleaning up ResourceProviders etc.

        • (): void
        • Returns void

    Returns Promise<IWpPublication>

Generated using TypeDoc