This package has been deprecated

Author message:

move to install-prompt-banner

install-prompt

0.0.1 • Public • Published

install-prompt npm version Build Status codecov

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';
// 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 dev

Test

yarn test

Package Sidebar

Install

npm i install-prompt

Weekly Downloads

3

Version

0.0.1

License

MIT

Unpacked Size

241 kB

Total Files

23

Last publish

Collaborators

  • blackbing