use-exit-intent
use-exit-intent copied to clipboard
Add mouseLeaveDelayInSeconds option for desktop exit intent
- Added
mouseLeaveDelayInSeconds
to theDesktopOptions
interface - Implemented a timer to enable mouse leave detection after the specified delay
- Updated the
useEffect
hook to handle the new behavior
This change helps prevent premature triggering of exit intent actions, especially useful for pages with longer load times or when users might accidentally move their mouse outside the window shortly after page load.
Example
const { settings, isTriggered, unsubscribe } = useExitIntent({
desktop: {
triggerOnMouseLeave: true,
mouseLeaveDelayInSeconds: 5 // Start detecting mouse leave 5 seconds after page load
}
})