@idle-observer/vue3

Vue 3 wrapper for idle-observer using Composition API.
2,010
Install
npm install @idle-observer/vue3
Latest Version:0.2.0
Vue:3
License:MIT
Last Updated:Jun 16, 2025
Links: npm
Maintainer: adbergen

IdleObserver Vue 3

Vue 3 integration for the robust idle-observer core. Detects user idleness in your Vue 3 apps, even with browser timer throttling.

Features

  • Timestamp-based idle detection (robust against timer throttling)
  • All core options: onIdle, onActive, onIdleWarning, activityEvents, idleWarningDuration
  • Pause, resume, reset, destroy methods
  • isIdle and isUserIdle state
  • Works with the Vue 3 Composition API

Installation

npm install @idle-observer/vue3
# or
pnpm add @idle-observer/vue3

Usage (Composition API)

import { useIdleObserver } from '@idle-observer/vue3'

export default {
  setup() {
    const { isIdle, isUserIdle, pause, resume, reset, destroy } = useIdleObserver({
      timeout: 60000,
      onIdle: () => {
        /* ... */
      },
      onActive: () => {
        /* ... */
      },
      onIdleWarning: () => {
        /* ... */
      },
      activityEvents: ['mousemove', 'keydown'],
      idleWarningDuration: 10000
    })
    return { isIdle, isUserIdle, pause, resume, reset, destroy }
  }
}

API

See core README for full option and method details.

Related Packages

@vue/composition-api

Provide logic composition capabilities for Vue.

6,521,705 4,179
vue-composition-global-subscription

A Component to handle global events and data

345
@prefecthq/vue-compositions

A collection of reusable vue compositions.

86,897 7
@lehoczky/vue-keycloak

Keycloak plugin for Vue3 and Composition API

4,884

Version History

Version Released Vue License
0.2.0 3.5.16 MIT
0.1.4 3.5.16 MIT
0.1.3 3.5.16 MIT
0.1.2 3.5.16 MIT
0.1.0 3.5.16 MIT