forked from weizhenye/Danmaku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
68 lines (65 loc) · 1.42 KB
/
index.d.ts
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
interface Comment {
text?: string;
/**
* @default rtl
*/
mode?: 'ltr' | 'rtl' | 'top' | 'bottom';
/**
* Specified in seconds. Not required in live mode.
* @default media?.currentTime
*/
time?: number;
style?: Partial<CSSStyleDeclaration> | CanvasRenderingContext2D;
/**
* A custom render to draw comment.
* When it exist, `text` and `style` will be ignored.
*/
render?(): HTMLElement | HTMLCanvasElement;
}
interface DanmakuOption {
/**
* The stage to display comments will be appended to container.
*/
container: HTMLElement;
/**
* If it's not provided, Danmaku will be in live mode.
*/
media?: HTMLMediaElement;
/**
* Preseted comments, used in media mode
*/
comments?: Comment[];
/**
* Canvas engine may more efficient than DOM however it costs more memory.
* @default dom
*/
engine?: 'dom' | 'canvas';
/**
* The speed of comments in `ltr` and `rtl` mode.
*/
speed?: number;
}
declare class Danmaku {
constructor(option: DanmakuOption);
/**
* The speed of comments in `ltr` and `rtl` mode.
*/
get speed(): number;
set speed(s: number);
/**
* Destroy the instance and release memory.
*/
destroy(): Danmaku;
emit(comment: Comment): Danmaku;
show(): Danmaku;
hide(): Danmaku;
/**
* Clear current stage.
*/
clear(): Danmaku;
/**
* Do it when you resize container.
*/
resize(): Danmaku;
}
export default Danmaku;