I'm adding following event, which simply updates a variable with the actual time:
$(document).keyup(function () {
lastAction = new Date();
});
Now I'm wondering if this will decrease the browser performance? Would it be better to remove the event from document and add it with a timer (e.g. after 1s) again, so that not every keyup will fire?
$(function () {
$(document).keyup(actionevent);
});
function actionevent() {
lastAction = new Date();
$(document).off("keyup", actionevent);
intervalId = setTimeout(function () {
$(document).keyup(actionevent);
}, 1000);
}