Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cfware/before-install-prompt
Basic module to handle the `beforeinstallprompt` event.
https://github.com/cfware/before-install-prompt
Last synced: 29 days 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 (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-16T21:43:47.000Z (about 1 year ago)
- Last Synced: 2024-11-08T07:35:09.051Z (about 2 months ago)
- Language: JavaScript
- Size: 39.1 KB
- Stars: 1
- Watchers: 2
- 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