@analytics/activity-utils

0.1.16 • Public • Published

Activity Utilities

User activity listener utility in 847 bytes

See live demo.

import { onIdle, onWakeUp } from '@analytics/activity-utils'

const FIVE_MINUTES = 300e3

const opts = {
  timeout: FIVE_MINUTES,
}

onIdle((activeTime) => {
  console.log('Ive been idle for 5 minutes', activeTime)
}, opts)

onWakeUp(() => {
  console.log('Yay wake up, user is back')
}, opts)

Alternate libraries

Package Sidebar

Install

npm i @analytics/activity-utils

Weekly Downloads

3,687

Version

0.1.16

License

MIT

Unpacked Size

88.9 kB

Total Files

16

Last publish

Collaborators

  • davidwells