SwPush

Subscribe and listen to push notifications from the Service Worker.

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

属性

属性名类型说明
messages只读
subscription只读
isEnabled只读

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

方法

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

参数

options

Type: { serverPublicKey: string; }.

返回值

Promise<PushSubscription>

unsubscribe(): Promise<void>

参数

没有参数。

返回值

Promise<void>

注解

@Injectable()