BeforeInstallPromptEvent.hx 946 B

12345678910111213141516171819202122232425262728293031323334
  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. @:native("BeforeInstallPromptEvent")
  9. extern class BeforeInstallPromptEvent extends Event {
  10. /** The platforms on which this event was dispatched. **/
  11. final platforms: Array<String>;
  12. /** The user's choice to the install prompt. **/
  13. final userChoice: Promise<BeforeInstallPromptUserChoice>;
  14. /** Creates a new `BeforeInstallPromptEvent`. **/
  15. function new();
  16. /** Shows the install prompt. **/
  17. function prompt(): Promise<Dynamic>;
  18. }
  19. typedef BeforeInstallPromptUserChoice = {
  20. final outcome: BeforeInstallPromptUserChoiceOutcome;
  21. }
  22. enum abstract BeforeInstallPromptUserChoiceOutcome(String) {
  23. var Accepted = "accepted";
  24. var Dismissed = "dismissed";
  25. }