BeforeInstallPromptEvent.hx 909 B

123456789101112131415161718192021222324252627282930313233
  1. package js.html;
  2. import js.lib.Promise;
  3. /**
  4. The `BeforeInstallPromptEvent` is fired at the `Window.onbeforeinstallprompt` handler,
  5. before a user is prompted to install a web site to a home screen.
  6. @see https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent
  7. **/
  8. extern class BeforeInstallPromptEvent extends Event {
  9. /** The platforms on which this event was dispatched. **/
  10. final platforms: Array<String>;
  11. /** The user's choice to the install prompt. **/
  12. final userChoice: Promise<BeforeInstallPromptUserChoice>;
  13. /** Creates a new `BeforeInstallPromptEvent`. **/
  14. function new();
  15. /** Shows the install prompt. **/
  16. function prompt(): Promise<Dynamic>;
  17. }
  18. typedef BeforeInstallPromptUserChoice = {
  19. final outcome: BeforeInstallPromptUserChoiceOutcome;
  20. }
  21. enum abstract BeforeInstallPromptUserChoiceOutcome(String) {
  22. var Accepted = "accepted";
  23. var Dismissed = "dismissed";
  24. }