Interface WebPushJs
- All Superinterfaces:
Serializable
What web push asks of the browser, as a JavaScript definition for
Page.executeJs(Class). The functions it calls are installed by the
web push helper that the client bundle carries.
It lives here rather than next to the web push support, because the bundle is checked against the definitions found on the class path: a definition in an optional module would make a pre-built bundle mismatch every application that does not have that module.
For internal use only. May be renamed or removed in a future release.
- Since:
- 25.4
-
Method Summary
Modifier and TypeMethodDescriptionReads the push subscription of the service worker.Checks whether notifications are denied.Checks whether notifications are granted.Checks whether the service worker has a push subscription.Asks for the notification permission and subscribes to web push.Removes the push subscription of the service worker.
-
Method Details
-
registrationStatus
@JsExpression("return window.Vaadin.Flow.webPush.registrationStatus()") PendingJavaScriptResult registrationStatus()Checks whether the service worker has a push subscription.- Returns:
- the pending result, which answers with whether a subscription exists
-
notificationDenied
@JsExpression("return window.Vaadin.Flow.webPush.notificationDenied()") PendingJavaScriptResult notificationDenied()Checks whether notifications are denied.- Returns:
- the pending result, which answers with whether notifications are denied
-
notificationGranted
@JsExpression("return window.Vaadin.Flow.webPush.notificationGranted()") PendingJavaScriptResult notificationGranted()Checks whether notifications are granted.- Returns:
- the pending result, which answers with whether notifications are granted
-
subscribe
@JsExpression("return window.Vaadin.Flow.webPush.subscribe($0)") PendingJavaScriptResult subscribe(String publicKey) Asks for the notification permission and subscribes to web push.- Parameters:
publicKey- the public key of the application server- Returns:
- the pending result, which answers with the subscription
-
unsubscribe
@JsExpression("return window.Vaadin.Flow.webPush.unsubscribe()") PendingJavaScriptResult unsubscribe()Removes the push subscription of the service worker.- Returns:
- the pending result, which answers with the removed subscription, or with a message when there was none
-
getSubscription
@JsExpression("return window.Vaadin.Flow.webPush.getSubscription()") PendingJavaScriptResult getSubscription()Reads the push subscription of the service worker.- Returns:
- the pending result, which answers with the subscription, or with a message when there is none
-