detect-inactivity

Used to determine if a user is subject to inactivity timeouts, and to detect when those timeouts occur

Installation#

npm install @iqmetrix/detect-inactivity

Interface#

const detectInactivity = (options) => Promise<boolean>;
interface options = {
inactivityLength?: number;
target?: HTMLElement;
}

Example#

import detectInactivity from '@iqmetrix/detect-inactivity';
detectInactivity()
.then(console.log)
.catch(console.error);

See tests for more examples.

If the function cannot acquire a token, or a 401 response is received, the user is automatically redirected to the login page. Redirection blocks promise resolution, so there will not be an opportunity to handle these cases.

Sources#

Last updated on by Paulo Andrade