UNPKG

@readium/navigator

Version:

Next generation SDK for publications in Web Apps

51 lines (50 loc) 1.84 kB
import { Link, Locator, Publication, ReadingProgression } from "@readium/shared"; type cbb = (ok: boolean) => void; export interface ProgressionRange { start: number; end: number; } export interface VisualNavigatorViewport { readingOrder: string[]; progressions: Map<string, ProgressionRange>; positions: number[] | null; } export declare abstract class Navigator { abstract get publication(): Publication; abstract get currentLocator(): Locator; /** * Moves to the position in the publication corresponding to the given {Locator}. */ abstract go(locator: Locator, animated: boolean, cb: cbb): void; /** * Moves to the position in the publication targeted by the given link. */ abstract goLink(link: Link, animated: boolean, cb: cbb): void; /** * Moves to the next content portion (eg. page) in the reading progression direction. */ abstract goForward(animated: boolean, cb: cbb): void; /** * Moves to the previous content portion (eg. page) in the reading progression direction. */ abstract goBackward(animated: boolean, cb: cbb): void; /** * Destroy all resources associated with this navigator. Synonymous with "unmount" */ abstract destroy(): void; } export declare abstract class VisualNavigator extends Navigator { /** * Current reading progression direction. */ abstract get readingProgression(): ReadingProgression; /** * Moves to the left content portion (eg. page) relative to the reading progression direction. */ goLeft(animated: boolean | undefined, completion: cbb): void; /** * Moves to the right content portion (eg. page) relative to the reading progression direction. */ goRight(animated: boolean | undefined, completion: cbb): void; } export {};