A simple activity monitor to alert you when the user becomes active or inactive
npm install browser-activity-monitor --save
import { ActivityMonitor, ACTIVE, INACTIVE } from 'browser-activity-monitor'
const monitor = new ActivityMonitor(document)
monitor.on(ACTIVE, () => console.log('User is active!'))
monitor.on(INACTIVE, () => console.log('User is inactive!'))
// ...
monitor.destroy()
npm test
Apache-2.0