Enum Class WebNotificationPermission

java.lang.Object
java.lang.Enum<WebNotificationPermission>
com.vaadin.flow.component.webnotification.WebNotificationPermission
All Implemented Interfaces:
Serializable, Comparable<WebNotificationPermission>, Constable

public enum WebNotificationPermission extends Enum<WebNotificationPermission>
Whether the browser lets the application show notifications.

Held by WebNotification.permissionSignal(). Reading the value never shows a browser prompt. Typical usage:

  • Enum Constant Details

    • UNKNOWN

      public static final WebNotificationPermission UNKNOWN
      No value has been reported by the browser yet. Used only as the initial value of the signal before the bootstrap handshake delivers the real one, so it is essentially never observed in application code.
    • PROMPT

      public static final WebNotificationPermission PROMPT
      The user has not decided yet. Asking for permission with WebNotificationBinding.requestPermission() shows the browser's permission prompt.
    • GRANTED

      public static final WebNotificationPermission GRANTED
      The user allowed notifications for the application.
    • DENIED

      public static final WebNotificationPermission DENIED
      The user blocked notifications for the application. Browsers do not show the permission prompt again; the user has to allow notifications in the browser's site settings, after which the value changes to GRANTED when the user returns to the tab.
    • UNSUPPORTED

      public static final WebNotificationPermission UNSUPPORTED
      The browser has no Notifications API in this context: the page is not served from a secure context (HTTPS or localhost), or the browser does not implement the API.
  • Method Details

    • values

      public static WebNotificationPermission[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static WebNotificationPermission valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null