{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-interval",
  "files": [
    {
      "path": "registry/default/hooks/use-interval.ts",
      "content": "\"use client\"\n\nimport { useEffect, useLayoutEffect, useRef } from \"react\"\n\nconst useIsomorphicLayoutEffect =\n  typeof window !== \"undefined\" ? useLayoutEffect : useEffect\n\n/**\n * Custom hook that creates an interval that invokes a callback function at a specified delay using the [`setInterval API`](https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval).\n * @param {() => void} callback - The function to be invoked at each interval.\n * @param {number | null} delay - The time, in milliseconds, between each invocation of the callback. Use `null` to clear the interval.\n * @public\n * @see [Documentation](https://usehooks-ts.com/react-hook/use-interval)\n * @example\n * ```tsx\n * const handleInterval = () => {\n *   // Code to be executed at each interval\n * };\n * useInterval(handleInterval, 1000);\n * ```\n */\nexport function useInterval(callback: () => void, delay: null | number) {\n  const savedCallback = useRef(callback)\n\n  // Remember the latest callback if it changes.\n  useIsomorphicLayoutEffect(() => {\n    savedCallback.current = callback\n  }, [callback])\n\n  // Set up the interval.\n  useEffect(() => {\n    // Don't schedule if no delay is specified.\n    // Note: 0 is a valid value for delay.\n    if (delay === null) {\n      return\n    }\n\n    const id = setInterval(() => {\n      savedCallback.current()\n    }, delay)\n\n    return () => {\n      clearInterval(id)\n    }\n  }, [delay])\n}\n",
      "type": "registry:hook",
      "target": "hooks/limeplay/use-interval.ts"
    }
  ],
  "type": "registry:hook"
}