Skip to content

Commit

Permalink
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion static/timer.js
Original file line number Diff line number Diff line change
@@ -139,22 +139,37 @@ class Timer {
li.innerText = this.format(this.times);
this.results.appendChild(li);

console.log(this.format(this.times));

this.latest = this.times;
this.records.push(this.times);
this.records.sort(compare);
this.bestlap.innerText = this.format(this.records[0]);
}

remove() {
if (this.records.length == 0) {
return;
}

console.log(this.format(this.records[0]));

this.latest = null;
this.records.splice(0, 1);
this.bestlap.innerText = this.format(this.records[0]);
if (this.records.length == 0) {
this.bestlap.innerText = "";
} else {
this.bestlap.innerText = this.format(this.records[0]);
}
}

squeeze() {
if (!this.latest) {
return;
}

console.log(this.format(this.latest));

this.times[2] += this.latest[2];
this.times[1] += this.latest[1];
this.times[0] += this.latest[0];

0 comments on commit fca07d0

Please sign in to comment.