Methods

Methods are the API that is returned by IdleTimer. You can interface with your IdleTimer instance by using the following functions. Examples of how to use them can be found in the hook and higher order component docs.

start#


description

Resets the IdleTimer instance to its initial state and starts the timer.

type
() => void

reset#


description

Resets the IdleTimer instance to its initial state.

type
() => void

activate#


description

Resets the IdleTimer instance to its initial state, starts the timer and emits onActive if the user was idle.

type
() => void

pause#


description

Pauses the IdleTimer instance. When paused all events are unbound.

type
() => void

resume#


description

Resumes an IdleTimer instance from the time it was paused. When resumed, all events will be bound.

type
() => void

message#


description

Broadcast an arbitrary message to all instances of IdleTimer. If crossTab is enabled, all tabs will receive the message and their onMessage callback will be emitted. If emitOnSelf is set to true, the callee instance will also emit its onMessage callback.

type
(data: MessageType, emitOnSelf?: boolean) => void

isIdle#


description

Returns whether or not the user is idle.

type
() => boolean

isPrompted#


description

Returns whether or not the prompt is active.

type
() => boolean

isLeader#


description

Returns whether or not current tab is the leader.

type
() => boolean

getTabId#


description

Returns the current tabs id.

type
() => string

getRemainingTime#


description

Returns the number of milliseconds until idle.

type
() => number

getElapsedTime#


description

Returns the number of milliseconds since the hook was mounted.

type
() => number

getTotalElapsedTime#


description

Returns the number of milliseconds since the hook last reset.

type
() => number

getLastIdleTime#


description

Returns the last time the user was idle. Returns a Date instance that can be formatted.

type
() => Date | null

getLastActiveTime#


description

Returns the last time the user was active. Returns a Date instance that can be formatted.

type
() => Date | null

getTotalIdleTime#


description

Returns the total time in milliseconds user has been idle.

type
() => number

getTotalActiveTime#


description

Returns the total time in milliseconds user has been active.

type
() => number

Made withby Randy Lebeau