Is it possible to detect \"idle\" time in JavaScript? My primary use case probably would be to pre-fetch or preload content.
Idle time:
You can do it more elegantly with underscore and jquery-
$('body').on("click mousemove keyup", _.debounce(function(){ // do preload here }, 1200000)) // 20 minutes debounce