Compare commits

..

4 Commits

Author SHA1 Message Date
f6be9b71f1 3.0.5 2018-11-23 19:26:42 +01:00
9c2d584170 fix(core): update 2018-11-23 19:26:41 +01:00
10bff069c1 3.0.4 2018-11-23 18:48:08 +01:00
8f6272eca4 fix(core): update 2018-11-23 18:48:07 +01:00
4 changed files with 15 additions and 4 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smarttime",
"version": "3.0.3",
"version": "3.0.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "@pushrocks/smarttime",
"private": false,
"version": "3.0.3",
"version": "3.0.5",
"description": "handle timeformats in smart ways",
"main": "dist/index.js",
"typings": "dist/index.d.ts",

View File

@ -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();

View File

@ -61,8 +61,11 @@ export class Timer {
}
public pause() {
clearTimeout(this.currentTimeout);
this.pausedAt = TimeStamp.fromTimeStamp(this.startedAt);
if (this.startedAt) {
clearTimeout(this.currentTimeout);
this.currentTimeout = null;
this.pausedAt = TimeStamp.fromTimeStamp(this.startedAt);
}
}
public resume() {