Inactivity Timer
Run a function after a period of inactivity.
Installation
npm install --save inactivity-timer
Usage
const createInactivityTimer = // Lock the screen after 5 min of idleconst lockTimer = // Signal activity when the mouse movesdocument
API
createInactivityTimer(threshold, onInactivity) => InactivityTimer
Create a new InactivityTimer
.
threshold
can be specied as either a number, in milliseconds, or any string that the ms
module can parse.
InactivityTimer#clear()
Clear any timer currently scheduled.
InactivityTimer#signal()
Signal activity, which will extend the time until onInactivity
is called with the earlier specified threshold
.