Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Sinres's avatar

Idle function in Vue 3 Composition api

Hello!

I want to make idle function for my Vue 3 App. I wanted to ask which packages are worth using or maybe it's better to write the function yourself? I would like a popup with the information "No interaction - your cart will be emptied - 10, 9, 8, 7" to be displayed after 10 minutes without user interaction. When the user moves the mouse or uses the keyboard, the popup disappears and the time starts counting down again

I tried to use a package: [url]https://github.com/hemisphere24/idle-vue[/url]

But the package doesn't work or I implement badly for Composition API

Thanks!

0 likes
1 reply
drehimself's avatar

It looks like that package is just a wrapper around the idle-js package for vanilla JS: https://github.com/soixantecircuits/idle-js. Maybe try that out directly in your Vue app.

You can try writing it yourself too if you like. The source for that package is just one file and looks pretty readable.

Please or to participate in this conversation.