ngx-pwa
Version:
Provides functionality around the progressive web app functionality in angular. Most notably the an approach to cache POST, UPDATE and DELETE requests.
41 lines (40 loc) • 1.4 kB
TypeScript
import { HttpClient } from '@angular/common/http';
import { SwPush } from '@angular/service-worker';
/**
* A base service that provides functionality regarding notifications.
*/
export declare abstract class NgxPwaNotificationService {
private readonly swPush;
private readonly http;
/**
* The url to send a new push subscription to.
*/
abstract readonly API_ENABLE_NOTIFICATIONS_URL: string;
/**
* The url to send a request to when wanting to disable notifications.
*/
abstract readonly API_DISABLE_NOTIFICATIONS_URL: string;
/**
* The public key of your VAPID key pair.
* Is needed to receive and display push notifications.
*/
abstract readonly VAPID_PUBLIC_KEY: string;
/**
* Whether or not the current user has notifications enabled.
*/
get hasNotificationsEnabled(): boolean;
constructor(swPush: SwPush, http: HttpClient);
/**
* Asks the user for permission to use push notifications.
*/
askForNotificationPermission(): Promise<void>;
/**
* Enables notifications by sending a push subscription to the server.
* @param pushSubscription - The push subscription to send to the server.
*/
protected enableNotifications(pushSubscription: PushSubscription): Promise<void>;
/**
* Disables notifications.
*/
disableNotifications(): Promise<void>;
}