Analytics
/
User Activity Utils
Utility library for firing events on user idle & wake up
User activity listener utility in 847 bytes
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)