This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

use-before-install-prompt
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

This project has been deprecated. Move to use-pwa-install

use-before-install-prompt

React hook for beforeinstallprompt event

Install

npm i use-before-install-prompt

Usage

import React from 'react';
import useBeforeInstallPrompt from 'use-before-install-prompt';

const App = () => {
  const { isInstalled, addToHomeScreen } = useBeforeInstallPrompt();

  return (
    <>
      {!isInstalled && (
        <button onClick={addToHomeScreen}>Add to home screen</button>
      )}
    </>
  );
};

Options

options Type Description Required Default Value
acceptedFn Function Callback function to execute when accepted no console.log()
dismissedFn Function Callback function to execute when dismissed no console.log()
installedFn Function Callback function to execute when installed no console.log()

Return value

value Type Description
isInstalled boolean Install state
addToHomeScreen Function Add to home screen function

Browser compatibility

https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent#browser_compatibility

Package Sidebar

Install

npm i use-before-install-prompt

Weekly Downloads

12

Version

1.0.5

License

MIT

Unpacked Size

63 kB

Total Files

14

Last publish

Collaborators

  • qvil