A magic helper to track page visibility. It exposes the following properties:
Property | Type | Description |
---|---|---|
isVisible |
boolean |
Whether the user is idle or not |
As script tag, include the <script>
tag in the <head>
of your document just before Alpine:
<script src="https://cdn.jsdelivr.net/npm/alpinejs-toolkit/dist/useVisibility/cdn.min.js" defer></script>
As module:
import Alpine from 'alpinejs';
import UseVisibility from 'alpinejs-toolkit/useVisibility';
Alpine.plugin(UseVisibility);
Alpine.start();
TODO Add an usage example