Define a key timeout
this event is always executed after defined milliseconds, if no key is pressed
and is always executed again after defined time
let InternalNumber=window.setKeyTimeout(function,timer in milliseconds)
(Note: system check only keyboard activities)
you can clear this timer with
window.clearKeyTimeout(internalNumber);
Example:
close window, if user do nothing after 10 seconds
window.setKeyTimeout(()=>window.cancel();,10000);