From 8f6272eca466d14961b46340ee0c3ca4a91e5d9e Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Fri, 23 Nov 2018 18:48:07 +0100 Subject: [PATCH] fix(core): update --- test/test.timer.ts | 8 ++++++++ ts/smarttime.classes.timer.ts | 1 + 2 files changed, 9 insertions(+) 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); }