Vue Composable to handle user's Exit Intent behavior
This is an old refactored package, that I just published on NPM.
Be sure to use the latest release.
It's a composable that allows you to easily implement an exit intent strategy in your Vue application.
See the GitHub repo, and feel free to contribute.
You can install the package via NPM:
npm i vue-exit-intent
Then import the composable and use it in your app:
<sript setup lang="ts">
import { useVueExitIntent } from 'vue-exit-intent'
const options = {
LSItemKey: 'local-storage-key',
handleScrollBars: true
}
const { isShowing, close } = useVueExitIntent(options);
</script>
<template>
<yourModalPopUp v-if="isShowing" @close="close"></yourModalPopUp>
</template>
You can also use all available helpers like this:
const {
isShowing,
isAllowedToGetTriggered,
isUnsubscribed,
close,
resetState,
unsubscribe
} = useVueExitIntent(options);
The package comes with a variety of options that allow you to customize the behavior of your exit intent popup. You can find the full list of options in the documentation.
I hope you find it useful.
Let me know if you have any questions or feedback!
Top comments (4)
nice text komsu! :)
Thank you! :D
nice
I'm glad you liked it! <3