Vue sensor hook that tracks if user on the page is idle.
<template>
<div>
<div>User is idle: {isIdle ? 'Yes π΄' : 'Nope'}</div>
</div>
</template>
<script>
import { useIdle } from "vue-next-use";
export default {
setup() {
const isIdle = useIdle(3e3);
return {
isIdle,
};
},
};
</script>
useIdle(ms, initialState);
ms
β time in milliseconds after which to consider use idle, defaults to60e3
β one minute.initialState
β whether to consider user initially idle, defaults to false.