https://github.com/cfware/before-install-prompt
Basic module to handle the `beforeinstallprompt` event.
https://github.com/cfware/before-install-prompt
Last synced: 3 months ago
JSON representation
Basic module to handle the `beforeinstallprompt` event.
- Host: GitHub
- URL: https://github.com/cfware/before-install-prompt
- Owner: cfware
- License: mit
- Created: 2019-03-20T21:02:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T21:43:47.000Z (about 2 years ago)
- Last Synced: 2025-09-07T00:59:52.111Z (3 months ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @cfware/before-install-prompt [![NPM Version][npm-image]][npm-url]
Basic module to handle the `beforeinstallprompt` window event.
## Usage
```js
import {promptInstallWait, promptInstallShow} from '@cfware/before-install-prompt';
function readyToShowPrompt() {
/* This function should display a button on the page which will call
* promptInstallShow(); when clicked.
*/
promptInstallShow();
}
promptInstallWait(readyToShowPrompt);
```
### promptInstallWait(callback)
Register a function to be called when `promptInstallShow` is able to show a prompt.
### promptInstallShow()
Show the install prompt if possible. This function will silently fail if it's not
possible to show the prompt.
[npm-image]: https://img.shields.io/npm/v/@cfware/before-install-prompt.svg
[npm-url]: https://npmjs.org/package/@cfware/before-install-prompt