summaryrefslogtreecommitdiff
path: root/lib/epub.js/types/annotations.d.ts
blob: 718319d9c521757518f834ea3a4ab05342d5dd84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import Rendition from "./rendition";
import View from "./managers/view";

export default class Annotations {
  constructor(rendition: Rendition);

  add(type: string, cfiRange: string, data?: object, cb?: Function, className?: string, styles?: object): Annotation;

  remove(cfiRange: string, type: string): void;

  highlight(cfiRange: string, data?: object, cb?: Function, className?: string, styles?: object): void;

	underline(cfiRange: string, data?: object, cb?: Function, className?: string, styles?: object): void;

	mark(cfiRange: string, data?: object, cb?: Function): void;

  each(): Array<Annotation>

  private _removeFromAnnotationBySectionIndex(sectionIndex: number, hash: string): void;

  private _annotationsAt(index: number): void;

  private inject(view: View): void;

  private clear(view: View): void;
}

declare class Annotation {
  constructor(options: {
		type: string,
		cfiRange: string,
		data?: object,
		sectionIndex?: number,
		cb?: Function,
		className?: string,
		styles?: object
	});

  update(data: object): void;

  attach(view: View): any;

  detach(view: View): any;

  // Event emitters
  emit(type: any, ...args: any[]): void;

  off(type: any, listener: any): any;

  on(type: any, listener: any): any;

  once(type: any, listener: any, ...args: any[]): any;
}