Skip to content
Timer to track user inactivity.
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Inactivity Timer

Inactivity Timer tracks whether the user is active. The timer is reset when either the mousemove, keydown or mousedown events fire. Because the mousemove event fires often you can set the granularity of the timer. For instance if the user is deemed inactive after 30 minutes, then setting the accuracy to 10 seconds would be reasonable. Then the mousemove event will be attached 10 seconds after the last mousemove.


  • MooTools 1.3


Create a new timer with defaults:

timer = new InactivityTimer();

Create a timer for 60 seconds and an accuracy of 5 seconds:

timer = new InactivityTimer({
    timeout: 60000,
    eventTimeoutLength: 5000
Something went wrong with that request. Please try again.