From f39547168569e3518c6c95cf9e2b2d69501e6b62 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Fri, 20 Dec 2024 15:57:23 -0700 Subject: [PATCH] Remove unused utils and hooks --- src/application/hooks/useInterval.ts | 15 --------------- src/application/utilities/debounce.ts | 14 -------------- 2 files changed, 29 deletions(-) delete mode 100644 src/application/hooks/useInterval.ts delete mode 100644 src/application/utilities/debounce.ts diff --git a/src/application/hooks/useInterval.ts b/src/application/hooks/useInterval.ts deleted file mode 100644 index a2aa532e0..000000000 --- a/src/application/hooks/useInterval.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { useEffect, useLayoutEffect, useRef } from "react"; - -export function useInterval(callback: () => void, ms: number) { - const callbackRef = useRef(callback); - - useLayoutEffect(() => { - callbackRef.current = callback; - }); - - useEffect(() => { - const id = setInterval(() => callbackRef.current(), ms); - - return () => clearInterval(id); - }, [ms]); -} diff --git a/src/application/utilities/debounce.ts b/src/application/utilities/debounce.ts deleted file mode 100644 index 1264cee8c..000000000 --- a/src/application/utilities/debounce.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -export function debounce void>( - this: any, - ms: number, - fn: T -): T { - let timer: NodeJS.Timeout; - - return ((...args: any[]) => { - clearTimeout(timer); - - timer = setTimeout(() => fn.call(this, ...args), ms); - }) as T; -}