-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
/
index.ts
55 lines (40 loc) 路 1.03 KB
/
index.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
// Extensions
import { Service } from '../service'
// Types
import { TargetPropValues, TargetProp, Application as IApplication } from 'vuetify/types/services/application'
export class Application extends Service implements IApplication {
static property: 'application' = 'application'
bar = 0
top = 0
left = 0
insetFooter = 0
right = 0
bottom = 0
footer = 0
application: Dictionary<TargetPropValues> = {
bar: {},
top: {},
left: {},
insetFooter: {},
right: {},
bottom: {},
footer: {},
}
register (
uid: number,
location: TargetProp,
size: number
) {
this.application[location][uid] = size
this.update(location)
}
unregister (uid: number, location: TargetProp) {
if (this.application[location][uid] == null) return
delete this.application[location][uid]
this.update(location)
}
update (location: TargetProp) {
this[location] = Object.values(this.application[location])
.reduce((acc: number, cur: number): number => (acc + cur), 0)
}
}