Created
September 6, 2019 22:30
-
-
Save alieslamifard/559448f4448200f21acdf561c38f681e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const [installationStatus, installationEvent] = useInstallPrompt(true); | |
useEffect(() => { | |
// installationStatus is one of these states: null/dismissed/accepted/installed | |
if(installationStatus === 'accepted') { | |
// User accept it. You can save it in some log with device config. | |
} | |
// Show Add-to-home-screen prompt, if user have it's condition. | |
if(installationEvent) { | |
installationEvent.prompt(); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment