Create a Diva viewer in an existing root element.
HTML id of the root element, without a leading #.
Initial resource and display options.
ReadonlyreadyResolves when the initial resource and selected initial page are ready.
Collections without an active manifest resolve when their collection UI is ready. Calling Diva.setResource before readiness supersedes the constructor resource, so this promise follows that replacement. It rejects when the resource that owns startup fails or the instance is destroyed.
Register a listener for a typed Diva event.
Event name from DivaEventMap.
Callback invoked with the event's typed CustomEvent.
Optionaloptions: boolean | AddEventListenerOptions
Standard DOM listener options.
Register a listener for a typed Diva event.
Event name from DivaEventMap.
Callback invoked with the event's typed CustomEvent.
Optionaloptions: boolean | AddEventListenerOptions
Standard DOM listener options.
Remove a previously registered Diva event listener.
Event name from DivaEventMap.
Callback originally passed to Diva.addEventListener.
Optionaloptions: boolean | EventListenerOptions
Standard DOM listener options used for matching.
Remove a previously registered Diva event listener.
Event name from DivaEventMap.
Callback originally passed to Diva.addEventListener.
Optionaloptions: boolean | EventListenerOptions
Standard DOM listener options used for matching.
Return a defensive snapshot of current viewer state.
State that callers may retain without observing later mutations.
Return defensive metadata snapshots for every displayed page.
Pages in zero-based display order. Auth tokens and resolved loading URLs are never included.
Find a displayed page by Canvas identifier or localized display label.
Exact Canvas-ID or complete label lookup.
A defensive page snapshot, or undefined when no page matches.
TypeError
Thrown when a runtime value is not a valid DivaPageSelector.
Return metadata for the active page, if the resource has pages.
The active page, or undefined before page initialization and for collections without an active manifest.
Return the pages in the active row or opening.
One page in single mode, or the pages belonging to the current logical opening in a spread mode.
Return the current single-page or spread layout mode.
The active DivaLayoutMode.
Replace the current IIIF manifest or collection without replacing this instance.
URL of a IIIF Presentation manifest or collection.
A promise that resolves when the replacement and its first displayable page are ready.
DOMException
Rejected with AbortError when superseded by a newer replacement, or with
InvalidStateError when the viewer has been destroyed.
Event listeners remain attached. Fetching or parsing failures leave the previous resource active. Once a replacement parses, it becomes active; failure of its required image rejects while leaving that replacement and its unavailable-image UI in place. Calling this method before any resource is ready supersedes the constructor resource and determines the outcome of Diva.ready.
Navigate to a zero-based page index.
Target index in Diva.getPages.
A promise that resolves after the navigation command is accepted.
Navigate to a page selected by Canvas identifier or display label.
Page lookup using the matching rules from Diva.findPage.
true after navigation, or false without moving when no page matches.
Navigate to the previous page or opening for the active layout.
A promise that resolves after navigation, or immediately at the first opening.
Multiply the current viewport zoom by a positive factor.
Positive finite multiplier; values above 1 zoom in and values below 1 zoom out.
A promise that resolves after the zoom command is applied.
Zoom in by Diva's standard zoom factor.
A promise that resolves after multiplying the zoom by 1.6.
Zoom out by Diva's standard zoom factor.
A promise that resolves after dividing the zoom by 1.6.
Fit a page, or the current page when omitted, into the viewport.
OptionalpageIndex: number
Optional zero-based page index. Defaults to the active page.
A promise that resolves after the page image loads and is fitted.
Frame a full-resolution pixel rectangle on a page, waiting for that image when necessary.
Zero-based page index containing the region.
Rectangle in full-resolution image pixels from the upper-left origin.
Optionaloptions: ZoomToRegionOptions
Optional padding and animation settings.
A promise that resolves after the image loads and the viewport fits the region.
Change the page layout while preserving the active page.
Desired single-page or spread arrangement.
A promise that resolves after the layout is applied.
RangeError
Rejected for a value outside DivaLayoutMode.
Request fullscreen display; browser user-activation rules apply.
A promise that resolves when the root enters fullscreen or is already fullscreen.
Enter or exit fullscreen display; browser user-activation rules apply.
The promise returned by Diva.enterFullscreen or Diva.exitFullscreen.
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.
A browser viewer for IIIF Presentation manifests and collections.
Remarks
Diva is an
EventTarget. Listen on the instance for the typed events in DivaEventMap; OpenSeadragon objects, Elm ports, and authorization state are intentionally not part of the public API.Page indexes are zero-based. Commands that require a loaded viewer wait for Diva.ready or an active Diva.setResource operation.
Example: Browser global
Example: ES module