react-timer-hook
Advanced tools
Comparing version
interface TimerSettings { | ||
autoStart?: boolean; | ||
expiryTimestamp: number; | ||
expiryTimestamp: Date; | ||
onExpire?: () => void; | ||
@@ -16,3 +16,3 @@ } | ||
resume: () => void; | ||
restart: (newExpiryTimestamp: number, autoStart?: boolean) => void; | ||
restart: (newExpiryTimestamp: Date, autoStart?: boolean) => void; | ||
} | ||
@@ -24,3 +24,3 @@ | ||
autoStart?: boolean; | ||
offsetTimestamp?: number; | ||
offsetTimestamp?: Date; | ||
} | ||
@@ -36,3 +36,3 @@ | ||
pause: () => void; | ||
reset: (offsetTimestamp?: number, autoStart?: boolean) => void; | ||
reset: (offsetTimestamp?: Date, autoStart?: boolean) => void; | ||
} | ||
@@ -39,0 +39,0 @@ |
{ | ||
"name": "react-timer-hook", | ||
"version": "3.0.4", | ||
"version": "3.0.5", | ||
"description": "React timer hook is a custom react hook built to handle timers(countdown), stopwatch and time logic/state in your react component.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -75,3 +75,3 @@ ## react-timer-hook | ||
| --- | --- | --- | ---- | | ||
| expiryTimestamp | number(timestamp) | YES | this will define for how long the timer will be running | | ||
| expiryTimestamp | Date object | YES | this will define for how long the timer will be running | | ||
| autoStart | boolean | No | flag to decide if timer should start automatically, by default it is set to `true` | | ||
@@ -93,3 +93,3 @@ | onExpire | Function | No | callback function to be executed once countdown timer is expired | | ||
| resume | function | function if called after pause the timer will continue countdown from last paused state | | ||
| restart | function | function to restart timer with new expiryTimestamp, accept 2 arguments first is the new `expiryTimestamp` of type number(timestamp) and second is `autoStart` of type boolean to decide if it should automatically start after restart or not, default is `true` | | ||
| restart | function | function to restart timer with new expiryTimestamp, accept 2 arguments first is the new `expiryTimestamp` of type Date object and second is `autoStart` of type boolean to decide if it should automatically start after restart or not, default is `true` | | ||
@@ -149,3 +149,3 @@ | ||
| autoStart | boolean | No | if set to `true` stopwatch will auto start, by default it is set to `false` | | ||
| offsetTimestamp | number | No | this will define the initial stopwatch offset example: `const stopwatchOffset = new Date(); stopwatchOffset.setSeconds(stopwatchOffset.getSeconds() + 300);` this will result in a 5 minutes offset and stopwatch will start from 0:0:5:0 instead of 0:0:0:0 | | ||
| offsetTimestamp | Date object | No | this will define the initial stopwatch offset example: `const stopwatchOffset = new Date(); stopwatchOffset.setSeconds(stopwatchOffset.getSeconds() + 300);` this will result in a 5 minutes offset and stopwatch will start from 0:0:5:0 instead of 0:0:0:0 | | ||
@@ -152,0 +152,0 @@ ### Values |
23308
-0.06%