SwPush
Subscribe and listen to Web Push Notifications through Angular Service Worker.
class SwPush {}
messages
Observable<object>
Emits the payloads of the received push notification messages.
notificationClicks
Observable<{ action: string; notification: NotificationOptions & { title: string; }; }>
Emits the payloads of the received push notification messages as well as the action the user
interacted with. If no action was used the action
property contains an empty string ''
.
Note that the notification
property does not contain a
Notification object but rather a
NotificationOptions
object that also includes the title
of the Notification object.
subscription
Observable<PushSubscription | null>
Emits the currently active
PushSubscription
associated to the Service Worker registration or null
if there is no subscription.
isEnabled
boolean
True if the Service Worker is enabled (supported by the browser and enabled via
ServiceWorkerModule
).
requestSubscription
Promise<PushSubscription>
Subscribes to Web Push Notifications, after requesting and receiving user permission.
{ serverPublicKey: string; }
An object containing the serverPublicKey
string.
Promise<PushSubscription>
unsubscribe
Promise<void>
Unsubscribes from Service Worker push notifications.
Promise<void>