101.0.4 • Published 3 months ago

@types/dom-chromium-installation-events v101.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Installation

npm install --save @types/dom-chromium-installation-events

Summary

This package contains type definitions for dom-chromium-installation-events (https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/dom-chromium-installation-events.

index.d.ts

// Type definitions for non-npm package dom-chromium-installation-events 101.0
// Project: https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent
// Definitions by: Sergey Kozlov <https://github.com/dartess>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

type AppBannerPromptOutcome = 'accepted' | 'dismissed';

interface PromptResponseObject {
    readonly outcome: AppBannerPromptOutcome;
    readonly platform: string;
}

// https://github.com/w3c/manifest/wiki/Platforms
type BeforeInstallPromptEventPlatform =
    | 'chrome_web_store'
    | 'play'
    | 'itunes'
    | 'webapp'
    | 'windows'
    | 'f-droid'
    | 'amazon';

interface BeforeInstallPromptEvent extends Event {
    prompt(): Promise<void>;

    readonly platforms: BeforeInstallPromptEventPlatform[];
    readonly userChoice: Promise<PromptResponseObject>;
}

interface WindowEventMap {
    beforeinstallprompt: BeforeInstallPromptEvent;
    appinstalled: Event;
}

interface Window {
    onappinstalled?: ((this: Window, ev: Event) => any) | null;
    onbeforeinstallprompt?: ((this: Window, ev: BeforeInstallPromptEvent) => any) | null;
}

Additional Details

  • Last updated: Sat, 28 May 2022 17:31:29 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Sergey Kozlov.