I am trying to use the debounce function for setting automatic logout for my application. My understanding is that debounce function will fire the function after the 30 seconds if my application not used. I tried to read the documentation of debounce and feel like I have done the exact something. Am i missing out something? or Is my understanding totally wrong?
var logout_debounce = _.debounce(debounceHandler, 30);
function debounceHandler() {
location.reload();
}
$("body").on("mousemove", logout_debounce);
The time is in milliseconds so you would need to do
30 * 1000