Resets the IdleTimer instance to its initial state and starts the timer. Returns a boolean denoting if the instance was started successfully.
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#
() => boolean
reset#
Resets the IdleTimer instance to its initial state. Returns a boolean denoting if the instance was reset successfully.
() => boolean
activate#
Resets the IdleTimer instance to its initial state, restarting the timer, and emitting the onActive
event if the user was idle or prompted. Returns a boolean denoting if the instance was activated successfully.
() => boolean
pause#
Pauses the IdleTimer instance. When paused all events are unbound. Returns a boolean denoting if the instance was paused successfully.
() => boolean
resume#
Resumes an IdleTimer instance from the time it was paused. When resumed, all events will be bound. Returns a boolean denoting if the instance was resumed successfully.
() => boolean
message#
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. Returns a boolean denoting if the message was sent successfully.
(data: MessageType, emitOnSelf?: boolean) => boolean
isIdle#
Returns whether or not the user is idle.
() => boolean
isPrompted#
Returns whether or not the prompt is active.
() => boolean
isLeader#
Returns whether or not the current tab is the leader.
() => boolean
isLastActiveTab#
Returns whether or not the current tab is the last active tab.
() => boolean
getTabId#
Returns the current tabs id.
() => string
getRemainingTime#
Returns the number of milliseconds until idle.
() => number
getElapsedTime#
Returns the number of milliseconds since the hook was mounted.
() => number
getTotalElapsedTime#
Returns the number of milliseconds since the hook last reset.
() => number
getLastIdleTime#
Returns the last time the user was idle. Returns a Date instance that can be formatted.
() => Date | null
getLastActiveTime#
Returns the last time the user was active. Returns a Date instance that can be formatted.
() => Date | null
getIdleTime#
Returns the total time in milliseconds user has been idle since the last reset.
() => number
getTotalIdleTime#
Returns the total time in milliseconds user has been idle since the component mounted.
() => number
getActiveTime#
Returns the total time in milliseconds user has been active since the last reset.
() => number
getTotalActiveTime#
Returns the total time in milliseconds user has been active since the component mounted.
() => number