count-down-ts
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -14,2 +14,8 @@ class Countdown { | ||
start(c = 60, d = 0, callback) { | ||
if (c < d) { | ||
throw 'count-down-ts start(c, d, callback?) function c must be greater than d.'; | ||
} | ||
this.carry(c, d, callback); | ||
} | ||
carry(c, d, callback) { | ||
this.clear(); | ||
@@ -20,3 +26,3 @@ if (c >= d) { | ||
this.timer = setTimeout(() => { | ||
this.start(c - 1, d, callback); | ||
this.carry(c - 1, d, callback); | ||
}, 1000); | ||
@@ -23,0 +29,0 @@ } |
@@ -16,2 +16,8 @@ 'use strict'; | ||
start(c = 60, d = 0, callback) { | ||
if (c < d) { | ||
throw 'count-down-ts start(c, d, callback?) function c must be greater than d.'; | ||
} | ||
this.carry(c, d, callback); | ||
} | ||
carry(c, d, callback) { | ||
this.clear(); | ||
@@ -22,3 +28,3 @@ if (c >= d) { | ||
this.timer = setTimeout(() => { | ||
this.start(c - 1, d, callback); | ||
this.carry(c - 1, d, callback); | ||
}, 1000); | ||
@@ -25,0 +31,0 @@ } |
@@ -7,4 +7,5 @@ declare class Countdown { | ||
start(c?: number, d?: number, callback?: (c: number) => void): void; | ||
carry(c: number, d: number, callback?: (c: number) => void): void; | ||
} | ||
declare const _default: Countdown; | ||
export default _default; |
{ | ||
"name": "count-down-ts", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Countdown has timer, count, clear features. Test covered 100%.", | ||
@@ -5,0 +5,0 @@ "main": "dist/count-down-ts.js", |
@@ -39,3 +39,3 @@ # count-down-ts | ||
```typescript | ||
import { countdown } from 'count-down-ts' | ||
import countdown from 'count-down-ts' | ||
``` | ||
@@ -46,3 +46,3 @@ | ||
```javascript | ||
const { countdown } = require('count-down-ts') | ||
const countdown = require('count-down-ts') | ||
``` | ||
@@ -92,5 +92,5 @@ | ||
`count`: Default 60, type number. count must greater than down, or equal dowm. | ||
`count`: Default 60, type number. Tips: count must greater than down, or equal down. | ||
`down`: Default 0, type number | ||
`down`: Default 0, type number. | ||
@@ -97,0 +97,0 @@ `callback`: Type (height: number|undefined) => void. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40741
73