diff options
Diffstat (limited to 'lib/epub.js/types/locations.d.ts')
-rw-r--r-- | lib/epub.js/types/locations.d.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/epub.js/types/locations.d.ts b/lib/epub.js/types/locations.d.ts new file mode 100644 index 0000000..be314da --- /dev/null +++ b/lib/epub.js/types/locations.d.ts @@ -0,0 +1,41 @@ +import Spine from "./spine"; +import Section from "./section"; +import EpubCFI from "./epubcfi"; + +export default class Locations { + constructor(spine: Spine, request?: Function, pause?: number); + + generate(chars: number): object; + + process(section: Section): Promise<Array<string>>; + + locationFromCfi(cfi: string | EpubCFI): Location; + + percentageFromCfi(cfi: string | EpubCFI): number; + + percentageFromLocation(loc: number): number; + + cfiFromLocation(loc: number): string; + + cfiFromPercentage(percentage: number): string; + + load(locations: string): Array<string>; + + save(): string; + + currentLocation(): Location; + currentLocation(curr: string | number): void; + + length(): number; + + destroy(): void; + + private createRange(): { + startContainer: Element, + startOffset: number, + endContainer: Element, + endOffset: number + }; + + private parse(contents: Node, cfiBase: string, chars: number) : Array<string>; +} |