You can try idle-js with configured short idle: 10, // miliseconds and then listen to onActive callback.
idle: 10, // miliseconds
onActive