0.1.16 • Published 12 months ago

@analytics/activity-utils v0.1.16

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

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