export default Locations; /** * Find Locations for a Book * @extends {Map} */ declare class Locations extends Map { /** * Constructor * @param {Sections} [sections] * @param {function} [request] * @param {number} [pause=100] */ constructor(sections?: Sections, request?: Function, pause?: number); sections: any; request: Function | undefined; idref: any; pause: number; chars: number; processing: Defer; /** * @member {Location} current Current Location * @property {object} start * @property {object} end * @memberof Locations * @readonly */ readonly current: Location; /** * @member {Promise} generated * @memberof Locations * @readonly */ readonly generated: Promise; q: Queue; /** * Load all of sections in the book to generate locations * @param {number} [chars] how many chars to split on (default:150) * @return {Promise} Locations */ generate(chars?: number): Promise; /** * createRange * @returns {object} * @private */ private createRange; /** * process * @param {Section} section * @returns {Promise} */ process(section: Section): Promise; /** * parse * @param {Element} contents * @param {string} cfiBase * @param {number} [chars] * @returns {Promise} */ parse(contents: Element, cfiBase: string, chars?: number): Promise; /** * treeWalker * @param {Node} root * @param {function} func * @returns {Promise} * @private */ private treeWalker; /** * Finds where something would fit into a sorted array * @param {Location} item * @param {Location[]} array * @param {function} [compareFunc] colback func * @param {function} [start] * @param {function} [end] * @return {number} location (index in array) */ locationOf(item: Location, array: Location[], compareFunc?: Function, start?: Function, end?: Function): number; /** * Get a location from an EpubCFI * @param {string|EpubCFI} value EpubCFI * @return {number} Location index or -1 otherwise */ locationFromCfi(value: string | EpubCFI): number; /** * Get a percentage position in locations from an EpubCFI * @param {string|EpubCFI} cfi EpubCFI * @return {number} Percentage */ percentageFromCfi(cfi: string | EpubCFI): number; /** * Get a percentage position from a location index * @param {number} index Location index * @return {number} Percentage */ percentageFromLocation(index: number): number; /** * Get an EpubCFI from location index * @param {number} index Location index * @return {string|null} EpubCFI string format */ cfiFromLocation(index: number): string | null; /** * Get an EpubCFI from location percentage * @param {number} value Percentage in ranging from 0 to 1 * @return {string|null} EpubCFI string format */ cfiFromPercentage(value: number): string | null; /** * Load locations from JSON * @param {string} locations * @returns {Locations} */ load(locations: string): Locations; /** * Save locations to JSON * @param {number} [type] default 0, compact array 1 * @return {string} A JSON string */ save(type?: number): string; /** * Set current location * @param {any} key EpubCFI to string * @param {any} val Location * @example locations.set(key, val) * @example locations.set({ start: { cfi } }) * @example locations.set({ start: { index } }) * @example locations.set({ start: { percentage } }) * @example locations.set({ start, end }) * @returns {any} Locations * @override */ override set(key: any, val: any): any; /** * Destroy the Locations object */ destroy(): void; } import Defer from "./utils/defer"; import Location from "./location"; import Queue from "./utils/queue"; import EpubCFI from "./epubcfi";