Why
Activity is stamped, not timed: a timer reset per event does not scale to holds, refresh scheduling or cross-tab sync, and the current event list is dated.
Proposal
- Track a monotonic
lastActivityAt (performance.now() / injectable clock) instead of resetting a timeout on every event.
- Default events:
pointerdown (covers mouse, touch, pen), keydown (keypress is deprecated; keyboard-wedge scanners type), wheel, and a visibilitychange to visible. Configurable list.
- Listeners registered
passive: true, capture: true on window; removed on dispose().
- No
navigator.userActivation sampling — listeners are cheaper and cover every browser.
Why
Activity is stamped, not timed: a timer reset per event does not scale to holds, refresh scheduling or cross-tab sync, and the current event list is dated.
Proposal
lastActivityAt(performance.now()/ injectable clock) instead of resetting a timeout on every event.pointerdown(covers mouse, touch, pen),keydown(keypressis deprecated; keyboard-wedge scanners type),wheel, and avisibilitychangeto visible. Configurable list.passive: true, capture: trueonwindow; removed ondispose().navigator.userActivationsampling — listeners are cheaper and cover every browser.