Enum Class WebNotificationPermission
java.lang.Object
java.lang.Enum<WebNotificationPermission>
com.vaadin.flow.component.webnotification.WebNotificationPermission
- All Implemented Interfaces:
Serializable,Comparable<WebNotificationPermission>,Constable
Whether the browser lets the application show notifications.
Held by WebNotification.permissionSignal(). Reading the value never
shows a browser prompt. Typical usage:
PROMPT— show an "Enable notifications" button bound withWebNotification.onClick(com.vaadin.flow.component.Component)that asks for permission.GRANTED— callWebNotification.show(String)when there is something to tell the user.DENIED— explain how to re-enable notifications in the browser's site settings, and fall back to in-page messages.UNSUPPORTED— hide notification settings entirely and fall back to in-page messages.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionThe user blocked notifications for the application.The user allowed notifications for the application.The user has not decided yet.No value has been reported by the browser yet.The browser has no Notifications API in this context: the page is not served from a secure context (HTTPS orlocalhost), or the browser does not implement the API. -
Method Summary
Modifier and TypeMethodDescriptionstatic WebNotificationPermissionReturns the enum constant of this class with the specified name.static WebNotificationPermission[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
The user has not decided yet. Asking for permission withWebNotificationBinding.requestPermission()shows the browser's permission prompt. -
GRANTED
The user allowed notifications for the application. -
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 toGRANTEDwhen the user returns to the tab. -
UNSUPPORTED
The browser has no Notifications API in this context: the page is not served from a secure context (HTTPS orlocalhost), or the browser does not implement the API.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-