/
DivEvent.ts
53 lines (43 loc) · 1.34 KB
/
DivEvent.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
import { DivType } from "../../../../Enums/Types/DivType.js";
import type { IDivEvent } from "../../../Interfaces/Interactivity/Events/IDivEvent.js";
import type { IOptionLoader } from "../../../Interfaces/IOptionLoader.js";
import type { RecursivePartial } from "../../../../Types/RecursivePartial.js";
import type { SingleOrMultiple } from "../../../../Types/SingleOrMultiple.js";
/**
* [[include:Options/Interactivity/Div.md]]
*/
export class DivEvent implements IDivEvent, IOptionLoader<IDivEvent> {
/**
* The div event handler enabling mode
*/
enable;
/**
* Div mode values used by the event
*/
mode: SingleOrMultiple<string>;
selectors: SingleOrMultiple<string>;
type: DivType | keyof typeof DivType;
constructor() {
this.selectors = [];
this.enable = false;
this.mode = [];
this.type = DivType.circle;
}
load(data?: RecursivePartial<IDivEvent>): void {
if (!data) {
return;
}
if (data.selectors !== undefined) {
this.selectors = data.selectors;
}
if (data.enable !== undefined) {
this.enable = data.enable;
}
if (data.mode !== undefined) {
this.mode = data.mode;
}
if (data.type !== undefined) {
this.type = data.type;
}
}
}