use-exit-intent icon indicating copy to clipboard operation
use-exit-intent copied to clipboard

Add mouseLeaveDelayInSeconds option for desktop exit intent

Open baodoan opened this issue 5 months ago • 3 comments

  • Added mouseLeaveDelayInSeconds to the DesktopOptions 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
  }
})

baodoan avatar Sep 06 '24 17:09 baodoan