Skip to content

Commit

Permalink
main 🧊 rework use page leave
Browse files Browse the repository at this point in the history
  • Loading branch information
debabin committed Jun 15, 2024
1 parent 32e53c5 commit a06ada5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/usePageLeave/usePageLeave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ import { useEvent } from '../useEvent/useEvent';
* @name usePageLeave
* @description - Hook what calls given function when mouse leaves the page
*
* @param {() => void} callback The callback function what calls then mouse leaves the page
* @param {() => void} [callback] The callback function what calls then mouse leaves the page
* @returns {boolean} A boolean which determines if the mouse left the page
*
* @example
* usePageLeave(() => console.log('on leave'))
* const isLeft = usePageLeave(() => console.log('on leave'))
*/
export const usePageLeave = (callback?: () => void) => {
const [isLeft, setIsLeft] = React.useState(false);
Expand Down

0 comments on commit a06ada5

Please sign in to comment.