SwPush

class

npm Package @angular/service-worker
Module import { SwPush } from '@angular/service-worker';
Source service-worker/src/push.ts

Overview

class SwPush {
  constructor(sw: NgswCommChannel)
  get messages: Observable<object>
  get subscription: Observable<PushSubscription | null>
  get isEnabled: boolean
  requestSubscription(options: {...}): Promise<PushSubscription>
  unsubscribe(): Promise<void>
}

Description

Subscribe and listen to push notifications from the Service Worker.

Constructor

constructor(sw: NgswCommChannel)

Members

get messages: Observable<object>

get subscription: Observable<PushSubscription | null>

get isEnabled: boolean

Returns true if the Service Worker is enabled (supported by the browser and enabled via ServiceWorkerModule).

requestSubscription(options: { serverPublicKey: string; }): Promise<PushSubscription>

unsubscribe(): Promise<void>

Annotations

@Injectable()

© 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v5.angular.io/api/service-worker/SwPush