Skip to content

Commit

Permalink
🐞 Throw error when promptBeforeIdle >= timeout. #342
Browse files Browse the repository at this point in the history
  • Loading branch information
SupremeTechnopriest committed Apr 17, 2023
1 parent 2650328 commit 436138d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/useIdleTimer.tsx
Expand Up @@ -96,6 +96,10 @@ export function useIdleTimer ({
throw new Error(`❌ The value for the promptBeforeIdle property must fit in a 32 bit signed integer, ${MAX_TIMEOUT}.`)
}

if (promptBeforeIdle >= timeout) {
throw new Error(`❌ The value for the promptBeforeIdle property be less than the timeout property, ${timeout}.`)
}

if (promptBeforeIdle) {
timeoutRef.current = timeout - promptBeforeIdle
promptTimeoutRef.current = promptBeforeIdle
Expand Down

1 comment on commit 436138d

@vercel
Copy link

@vercel vercel bot commented on 436138d Apr 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.