0.0.1 • Published 8 years ago
install-prompt v0.0.1
install-prompt 
 
 
This is a small library for handling install Banner for Progreww Web Application(PWA).
Dependency
No dependency
Install
yarn add install-promptUsage
import InstallPrompt from 'install-prompt';
// initial installPrompt
const installPrompt = new InstallPrompt();
// add 1 count when user do some interactive
installPrompt.addCount();
// check if prompt should popup
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
promptKey: (string) default is 'installPrompt'
minimumPrompt: (number) default is 2
e.g,
const installPrompt = new InstallPrompt({
  promptKey: 'custom-localstorage-key',
  minumumPrompt: 5
});Development
yarn devTest
yarn test0.0.1
8 years ago