{"id":20691155,"url":"https://github.com/dotmind/react-use-pwa","last_synced_at":"2025-04-22T16:59:05.594Z","repository":{"id":52614273,"uuid":"360190574","full_name":"dotmind/react-use-pwa","owner":"dotmind","description":"Prompt to install Progressive Web App and more with React hooks.","archived":false,"fork":false,"pushed_at":"2021-04-23T12:49:42.000Z","size":156,"stargazers_count":30,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-19T09:21:01.537Z","etag":null,"topics":["hooks","pwa","react","tools"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotmind.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-21T13:58:35.000Z","updated_at":"2025-03-15T11:02:41.000Z","dependencies_parsed_at":"2022-09-26T16:31:15.021Z","dependency_job_id":null,"html_url":"https://github.com/dotmind/react-use-pwa","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotmind%2Freact-use-pwa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotmind%2Freact-use-pwa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotmind%2Freact-use-pwa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotmind%2Freact-use-pwa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotmind","download_url":"https://codeload.github.com/dotmind/react-use-pwa/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250284844,"owners_count":21405295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hooks","pwa","react","tools"],"created_at":"2024-11-16T23:15:29.510Z","updated_at":"2025-04-22T16:59:05.557Z","avatar_url":"https://github.com/dotmind.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg alt=\"header\" src=\"https://raw.githubusercontent.com/dotmind/react-use-pwa/master/assets/header.png\" /\u003e\n\u003c/div\u003e\n\u003ch1 align=\"center\"\u003e\n  @dotmind/react-use-pwa\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  Prompt to install Progressive Web App and more with React hooks. Builded by \u003ca href=\"https://dotmind.io/\" target=\"_blank\"\u003e.mind.io\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@dotmind/react-use-pwa\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@dotmind/react-use-pwa\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@dotmind/react-use-pwa\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dw/@dotmind/react-use-pwa\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/dotmind/react-use-pwa\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/dotmind/react-use-pwa\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/dotmind/rn-shadow-generator\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/types/typescript\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Menu\n\n- [Menu](#menu)\n- [✋ Disclaimer](#-disclaimer)\n- [💻 Installation](#-installation)\n- [👷‍♂️ How it's work](#️-how-its-work)\n  - [usePwa usage](#usepwa-usage)\n  - [usePwaAppSize usage](#usepwaappsize-usage)\n- [⚡️ Contributing](#️-contributing)\n- [🔐 License](#-license)\n\n\n## ✋ Disclaimer\n\nThis package help to prompt to install and manage Progressive Web App (PWA) installed with React hooks.\n\nPlease check if your app have the required criteria before use : [web.dev/install-criteria](https://web.dev/install-criteria/#criteria)\n\nWant to make a good PWA ? [Read this](https://web.dev/pwa-checklist/)\n\nSSR support ✅\n\n## 💻 Installation\n\n```bash\nyarn add @dotmind/react-use-pwa\n```\n\nor\n\n```bash\nnpm i @dotmind/react-use-pwa --save\n```\n\n## 👷‍♂️ How it's work\n\n### usePwa usage\n\n```javascript\nimport { useEffect, useCallback  } from 'react';\nimport { usePwa } from '@dotmind/react-use-pwa';\n\nconst App = () =\u003e {\n  const {\n    installPrompt,\n    isInstalled,\n    isStandalone,\n    isOffline,\n    canInstall,\n  } = usePwa();\n\n  const handleInstallPrompt = useCallback(() =\u003e {\n    if (canInstall) {\n      installPrompt();\n    }\n  }, [canInstall, installPrompt]);\n\n  if (isOffline) {\n    return \u003cp\u003ePlease check your network 📶\u003c/p\u003e;\n  }\n\n  if (!isInstalled || !isStandalone) {\n    return (\n      \u003cbutton onClick={handleInstallPrompt}\u003e\n        \u003cspan\u003eHey install our app 👋\u003c/span\u003e\n      \u003c/button\u003e\n    );\n  }\n\n  return (\n    \u003ch1\u003eWelcome to our new app 🚀\u003c/h1\u003e\n  );\n};\n\n```\n\n| | description | type |\n|-|-|-|\n| installPrompt | Show install prompt | `() =\u003e Promise\u003cvoid\u003e` |\n| isInstalled | Is app installed on device | `boolean` |\n| isStandalone | Is app run in standalone mode | `boolean` |\n| isOffline | Is app run in offline mode | `boolean` |\n| canInstall | Device can install app | `boolean` |\n| userChoice | Prompt user choice | `'accepted' \\| 'dismissed' \\| 'unknow'` |\n\n### usePwaAppSize usage\n\nChoose app launching width and height (only in desktop standalone mode).\n\n```javascript\nimport { usePwaAppSize } from '@dotmind/react-use-pwa';\n\nconst App = () =\u003e {\n  usePwaAppSize(400, 560);\n\n  return \u003cAppProvider /\u003e;\n};\n```\n\n| arguments | description | required | default value |\n|-|-|-|-|\n| width | App width | false | `800` |\n| height | App height | false | `800` |\n| options | App options | false | `{ fixed: false }` |\n\n**App options**\n\n| option | description | type\n|-|-|-|\n| fixed | User can't resize app width \u0026 height | `boolean`\n\n## ⚡️ Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## 🔐 License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotmind%2Freact-use-pwa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotmind%2Freact-use-pwa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotmind%2Freact-use-pwa/lists"}