@angular/service-worker
Version:
Angular - service worker tooling!
41 lines (40 loc) • 1.28 kB
TypeScript
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Observable } from 'rxjs';
import { NgswCommChannel } from './low_level';
/**
* Subscribe and listen to push notifications from the Service Worker.
*
* @publicApi
*/
export declare class SwPush {
private sw;
/**
* Emits the payloads of the received push notification messages.
*/
readonly messages: Observable<object>;
/**
* Emits the currently active
* [PushSubscription](https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription)
* associated to the Service Worker registration or `null` if there is no subscription.
*/
readonly subscription: Observable<PushSubscription | null>;
/**
* True if the Service Worker is enabled (supported by the browser and enabled via
* `ServiceWorkerModule`).
*/
readonly isEnabled: boolean;
private pushManager;
private subscriptionChanges;
constructor(sw: NgswCommChannel);
requestSubscription(options: {
serverPublicKey: string;
}): Promise<PushSubscription>;
unsubscribe(): Promise<void>;
private decodeBase64;
}