Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@dotmind/react-use-pwa
Advanced tools
Prompt to install Progressive Web App and more with React hooks
Prompt to install Progressive Web App and more with React hooks. Builded by .mind.io
This package help to prompt to install and manage Progressive Web App (PWA) installed with React hooks.
Please check if your app have the required criteria before use : web.dev/install-criteria
Want to make a good PWA ? Read this
SSR support ✅
yarn add @dotmind/react-use-pwa
or
npm i @dotmind/react-use-pwa --save
import { useEffect, useCallback } from 'react';
import { usePwa } from '@dotmind/react-use-pwa';
const App = () => {
const {
installPrompt,
isInstalled,
isStandalone,
isOffline,
canInstall,
} = usePwa();
const handleInstallPrompt = useCallback(() => {
if (canInstall) {
installPrompt();
}
}, [canInstall, installPrompt]);
if (isOffline) {
return <p>Please check your network 📶</p>;
}
if (!isInstalled || !isStandalone) {
return (
<button onClick={handleInstallPrompt}>
<span>Hey install our app 👋</span>
</button>
);
}
return (
<h1>Welcome to our new app 🚀</h1>
);
};
description | type | |
---|---|---|
installPrompt | Show install prompt | () => Promise<void> |
isInstalled | Is app installed on device | boolean |
isStandalone | Is app run in standalone mode | boolean |
isOffline | Is app run in offline mode | boolean |
canInstall | Device can install app | boolean |
userChoice | Prompt user choice | 'accepted' | 'dismissed' | 'unknow' |
Choose app launching width and height (only in desktop standalone mode).
import { usePwaAppSize } from '@dotmind/react-use-pwa';
const App = () => {
usePwaAppSize(400, 560);
return <AppProvider />;
};
arguments | description | required | default value |
---|---|---|---|
width | App width | false | 800 |
height | App height | false | 800 |
options | App options | false | { fixed: false } |
App options
option | description | type |
---|---|---|
fixed | User can't resize app width & height | boolean |
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
FAQs
Prompt to install Progressive Web App and more with React hooks
The npm package @dotmind/react-use-pwa receives a total of 238 weekly downloads. As such, @dotmind/react-use-pwa popularity was classified as not popular.
We found that @dotmind/react-use-pwa demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.