-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoneApp.js
More file actions
54 lines (44 loc) · 1.01 KB
/
DoneApp.js
File metadata and controls
54 lines (44 loc) · 1.01 KB
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
import DI from 'FuseJS/DI'
import Tags from 'Model/Tags'
import Timer from 'Model/Timer'
import Storage from 'Model/Storage'
import Log from 'Model/Log'
import Helpers from 'Model/Helpers'
import ControlCenter from 'Pages/ControlCenter'
import ManageTags from 'Pages/ManageTags'
import AddTag from 'Pages/AddTag'
export default class DoneApp {
constructor() {
DI(this)
this.title = "Done"
this.helpers = new Helpers()
this.storage = new Storage()
this.log = new Log()
this.tags = new Tags()
this.timer = new Timer()
this.pages = [new ControlCenter()]
}
tagButtonClicked() {
this.pages.push(new ManageTags())
}
addTagButtonClicked() {
this.pages.push(new AddTag())
}
get haveHistory() {
return this.pages.length > 1
}
onBackButton() {
if (this.haveHistory) {
this.pages.pop()
} else {
// TODO: if on Android, exit app (perhaps?)
}
}
onResetButton() {
this.timer.stopTimer()
this.tags.select("")
this.storage.reset()
this.tags.readStoredTags()
this.log.updateLog()
}
}