-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimer.js
More file actions
29 lines (26 loc) · 853 Bytes
/
Copy pathTimer.js
File metadata and controls
29 lines (26 loc) · 853 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
25
26
27
28
29
var shake;
function setUp() {
if (localStorage.getItem("timersJSON") == null) {
localStorage.setItem("timersJSON", JSON.stringify(timers));
}
timers = JSON.parse(localStorage.getItem("timersJSON"));
alert(timers.length);
}
class Timer {
constructor(id, type, time, shake, sound, description) {
this.id = id;
this.type = type;
this.time = time;
this.shake = shake;
this.sound = sound;
this.description = description;
}
}
function getShake(a){
shake = a;
}
function add(){
var timer = new Timer(timers.length+1, "timer", +document.getElementById("setTime").value*60000, shake, document.getElementById("setaudio").value, document.getElementById("descrInput").value);
timers.push(timer);
localStorage.setItem("timersJSON", JSON.stringify(timers));
}