diff --git a/test/test.timer.ts b/test/test.timer.ts index ad7ec6c..4cffb35 100644 --- a/test/test.timer.ts +++ b/test/test.timer.ts @@ -15,4 +15,12 @@ tap.test('should start timer', async () => { await testTimer.completed; }); +tap.test('should reset a timer', async () => { + testTimer.reset(); + testTimer.start(); + testTimer.reset(); + testTimer.start(); + await testTimer.completed; +}); + tap.start(); diff --git a/ts/smarttime.classes.timer.ts b/ts/smarttime.classes.timer.ts index e17c1bd..448a98f 100644 --- a/ts/smarttime.classes.timer.ts +++ b/ts/smarttime.classes.timer.ts @@ -62,6 +62,7 @@ export class Timer { public pause() { clearTimeout(this.currentTimeout); + this.currentTimeout = null; this.pausedAt = TimeStamp.fromTimeStamp(this.startedAt); }