Fix/58 roll issues (#67)

* fix/58-roll-issues: handle edge cases
This commit is contained in:
Carlos Valente
2021-12-15 22:31:34 +01:00
committed by GitHub
parent 1321aa555e
commit cd911aaaa2
6 changed files with 129 additions and 35 deletions
-23
View File
@@ -24,29 +24,6 @@ export class Timer {
constructor() {}
// call setup separately
setupWithSeconds(seconds, autoStart = false) {
// aux
const now = this._getCurrentTime();
this.clock = now;
// populate targets
this.duration = seconds * 1000;
this._finishAt = now + seconds * 1000;
// start counting
this._startedAt = now;
if (autoStart) {
this.state = 'start';
} else {
this._pausedAt = now;
this._pausedInterval = 0;
}
this._pausedTotal = 0;
this.update();
}
// update()
update() {
// get current time