IsIdle

Determine if a user is idle, and when was the last time they were active.

Demo

Idle: false

Last active: 0s ago

By default, the time of inactivity before marking the user as idle is 1 minute.

In this demo, it's 1 second.

Usage

	<script lang="ts">
  import { AnimationFrames, IsIdle } from "runed";
 
  const idle = new IsIdle({ timeout: 1000 });
</script>
 
<p>Idle: {idle.current}</p>
<p>
  Last active: {new Date(idle.lastActive).toLocaleTimeString()}
</p>	
MIT

© 2024 Svecosystem Team