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", "name": "@pushrocks/smarttime",
"version": "3.0.3", "version": "3.0.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

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

View File

@ -15,4 +15,12 @@ tap.test('should start timer', async () => {
await testTimer.completed; await testTimer.completed;
}); });
tap.test('should reset a timer', async () => {
testTimer.reset();
testTimer.start();
testTimer.reset();
testTimer.start();
await testTimer.completed;
});
tap.start(); tap.start();

View File

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