From a06ada5075b7e00f74cf59fa64a1a17eeaa8ba84 Mon Sep 17 00:00:00 2001 From: debabin Date: Sat, 15 Jun 2024 17:30:38 +0700 Subject: [PATCH] =?UTF-8?q?main=20=F0=9F=A7=8A=20rework=20use=20page=20lea?= =?UTF-8?q?ve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/usePageLeave/usePageLeave.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hooks/usePageLeave/usePageLeave.ts b/src/hooks/usePageLeave/usePageLeave.ts index 3aa6c0b1..77a56bf8 100644 --- a/src/hooks/usePageLeave/usePageLeave.ts +++ b/src/hooks/usePageLeave/usePageLeave.ts @@ -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);