use-idle-detection

1.2.0 • Public • Published

use-idleDetection

Custom hook to detect if the user is idle or not.

Installation

npm install use-idle-detection

with yarn:

yarn add use-idle-detection

Usage

import React from "react"

import useIdleDetection from "use-idle-detection"

const App = () => {
  const { isIdle } = useIdleDetection({
    timeout: 1000
  })

  return (
    <div>
      <h1>{isIdle ? "Idle" : "Not Idle"}</h1>
    </div>
  )
}

Options

Name Type Default Description
idleTimeout number 3000 The amount of time in milliseconds before the user is considered idle

License

MIT


Made with ❤️ by Muzammil Bilwani

Package Sidebar

Install

npm i use-idle-detection

Weekly Downloads

1

Version

1.2.0

License

MIT

Unpacked Size

87.1 kB

Total Files

17

Last publish

Collaborators

  • bilwani12