{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "use-window-size",
  "title": "useWindowSize",
  "description": "A hook to get the window size",
  "files": [
    {
      "path": "registry/hooks/use-window-size.ts",
      "content": "'use client'\n\nimport * as React from 'react'\n\ninterface WindowSize {\n  width: number\n  height: number\n}\n\nexport function useWindowSize(): WindowSize {\n  const windowSizeSubscriber = React.useCallback((callback: () => void) => {\n    const abortController = new AbortController()\n\n    window.addEventListener('resize', callback, { signal: abortController.signal })\n\n    return () => {\n      abortController.abort()\n    }\n  }, [])\n\n  const getSnapshot = React.useCallback(() => {\n    return {\n      width: typeof window !== 'undefined' ? window.innerWidth : 0,\n      height: typeof window !== 'undefined' ? window.innerHeight : 0,\n    }\n  }, [])\n\n  const getServerSnapshot = React.useCallback(() => {\n    return {\n      width: 0,\n      height: 0,\n    }\n  }, [])\n\n  const windowSize = React.useSyncExternalStore(\n    windowSizeSubscriber,\n    getSnapshot,\n    getServerSnapshot,\n  )\n\n  return windowSize\n}\n",
      "type": "registry:hook",
      "target": "hookas/use-window-size.ts"
    }
  ],
  "type": "registry:hook"
}