-
-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathreports.ts
More file actions
24 lines (20 loc) · 566 Bytes
/
Copy pathreports.ts
File metadata and controls
24 lines (20 loc) · 566 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// A Singleton Dictionary of Reported Events
export default class Reports {
static instance: Reports
#reports: { [id: string]: [number, string] } = {}
#rowId = 0
constructor() {
if (Reports.instance) {
return Reports.instance
}
Reports.instance = this
}
getHistory(): { [id: string]: [number, string] } {
return this.#reports
}
logEvent(event: string): boolean {
this.#reports[this.#rowId] = [Date.now(), event]
this.#rowId = this.#rowId + 1
return true
}
}