SupremeTechnopriest/react-idle-timer

View on GitHub
docs/pages/docs/features/confirm-prompt.mdx

Summary

Maintainability
Test Coverage
---
title: 'Confirm Prompt'
description: Confirm Prompt feature explanation and example
---

A common use case for IdleTimer is to detect when you user has gone idle and then
prompt them to see if they are still there. Handling of this common use case is 
now built in to IdleTimer.

### Properties

The properties associated with the confirm prompt feature are:

{/* cspell:disable */}
- [timeout](/docs/api/props#timeout): The time before the `onIdle` event will be emitted.
- [promptBeforeIdle](/docs/api/props#promptbeforeidle): How long before idle to emit the `onPrompt` event.
- [onPresenceChange](/docs/api/props#onpresencechange): Function called when a user's presence state changes.
- [onPrompt](/docs/api/props#onprompt): Function called after the idle timeout is reached.
{/* cspell:enable */}

### Methods

The methods associated with the confirm prompt feature are:

{/* cspell:disable */}
- [isPrompted()](/docs/api/methods#isprompted): Returns true if the prompt is displayed.
{/* cspell:enable */}

### Example
<CodeSandbox name='confirm-prompt-y8ew9s' />