Skip to content

Commit

Permalink
update date types
Browse files Browse the repository at this point in the history
  • Loading branch information
amrlabib committed Sep 12, 2021
1 parent 8584992 commit 1576f20
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function App() {

| key | Type | Required | Description |
| --- | --- | --- | ---- |
| 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` |
| onExpire | Function | No | callback function to be executed once countdown timer is expired |

Expand All @@ -89,7 +89,7 @@ export default function App() {
| pause | function | function to be called to pause timer |
| start | function | function if called after pause the timer will continue based on original expiryTimestamp |
| 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` |


---
Expand Down Expand Up @@ -144,7 +144,7 @@ export default function App() {
| key | Type | Required | Description |
| --- | --- | --- | ---- |
| 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 |

### Values

Expand Down
4 changes: 2 additions & 2 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function useTimer(settings: TimerSettings): TimerResult

interface StopwatchSettings {
autoStart?: boolean;
offsetTimestamp?: number;
offsetTimestamp?: Date;
}

interface StopwatchResult {
Expand All @@ -31,7 +31,7 @@ interface StopwatchResult {
isRunning: boolean;
start: () => void;
pause: () => void;
reset: (offsetTimestamp?: number, autoStart?: boolean) => void;
reset: (offsetTimestamp?: Date, autoStart?: boolean) => void;
}

export function useStopwatch(settings?: StopwatchSettings): StopwatchResult
Expand Down

0 comments on commit 1576f20

Please sign in to comment.