pwa-install-handler
Version:
Handle beforeinstallprompt event in your PWA.
31 lines (30 loc) • 901 B
TypeScript
import { BeforeInstallPromptEvent } from './BeforeInstallPromptEvent';
type CanInstallCallback = (canInstall: boolean, install?: () => Promise<boolean>) => void;
declare class PwaInstallHandler {
private event;
private callbacks;
constructor();
/**
* Triggers install prompt.
*/
install: () => Promise<boolean>;
/**
* Returns internal `BeforeInstallPromptEvent`.
*/
getEvent(): BeforeInstallPromptEvent;
/**
* Tells whether the app is ready to be installed.
*/
canInstall(): boolean;
private updateEvent;
/**
* Adds listener with a callback which is called when installability state changes.
*/
addListener(callback: CanInstallCallback): void;
/**
* Removes listener.
*/
removeListener(callback: CanInstallCallback): void;
}
export declare const pwaInstallHandler: PwaInstallHandler;
export {};