@twoavy/idle-timer
v2.0.6
Published
A timer resetting itself on click & touch
Downloads
6
Keywords
Readme
idle-timer
A Vue plugin to track idle time
Installation
npm i @twoavy/idle-timer
OR
yarn add @twoavy/idle-timer
import idleTimer from 'idle-timer';
Usage
####Initialize (main.js)
app.use(idleTimer, {
idleTime: 30, // secs
trigger: ['mousedown', 'touchstart']
})
####In component (within setup)
// idle event
const idleTimer = inject('idle-timer')
idleTimer.emitter.on('idle', () => {
console.log('idle')
})
// restart
idleTimer.restart()