'Execute Javascript function on each "activity"

So my JBoss has a session inactivity timer of 60 minutes, so the user gets logged out after an hour without activity.

I want to display a countdown that resets on each "activity", but what exactly counts as activity and how can I couple my JS function to any such activity?

We're using JBoss 7.2 and a Primefaces/JSF web application.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source