install-prompt
This is a small library for handling install Banner for Progreww Web Application(PWA).
Dependency
No dependency
Install
yarn add install-prompt
Usage
import InstallPrompt from 'install-prompt';
const installPrompt = new InstallPrompt();
installPrompt.addCount();
installPrompt.checkPrompt();
Real example (React)
import InstallPrompt from 'install-prompt';
...
componentDidMount() {
this.installPrompt = new InstallPrompt();
this.installPrompt.addCount();
}
componentWillReceiveProps(nextProps) {
if (nextProps.cid !== this.props.cid) {
this.installPrompt.addCount().checkPrompt();
}
}
Options
e.g,
const installPrompt = new InstallPrompt({
promptKey: 'custom-localstorage-key',
minumumPrompt: 5
});
Development
yarn dev
Test
yarn test