@certsy/universal-idle-timeout
TypeScript icon, indicating that this package has built-in type declarations

0.2.9 • Public • Published

universal-idle-timeout

universal-idle-timeout is based on the excellent idleTimeout which is a zero dependency, ~5KB library to make idle state detection in the browser an ease. universal-idle-timeout maintains a universal user action tracking system across all of the tabs by using localstorage. When localstorage is not available, it gracefully degrades to tracking the actions in the current tab.

Installation

Using npm

npm install @certsy/universal-idle-timeout

Using yarn

yarn add @certsy/universal-idle-timeout

Usage

idleTimeout is totally easy to use. All you basically need to do is:

idleTimeout(() => {
  // Do some cool stuff
});

Documentation

The idleTimeout constructor takes two arguments:

  • callback [Function] - The callback function
  • options [Object] - An optional options object
    • element [Element] - The element to listen for the timeout
    • timeout [Number] - The idle timeout (in milliseconds)
const instance = idleTimeout(
  () => {
    // Callback
  },
  {
    element: document,
    timeout: 1000 * 60 * 5
  }
);

Readme

Keywords

none

Package Sidebar

Install

npm i @certsy/universal-idle-timeout

Weekly Downloads

1

Version

0.2.9

License

MIT

Unpacked Size

32.9 kB

Total Files

18

Last publish

Collaborators

  • xrusso
  • askorkin
  • phuc.nguyen