UNPKG

@ztimson/momentum

Version:

Client library for momentum

39 lines 1.27 kB
import { Message, PathEventEmitter } from './core'; import { Momentum } from './momentum'; /** Push notification */ export type Notification = Message & { /** Message recipients, null for everyone */ to?: string | string[] | null; /** Message subject/title */ subject?: string; /** Open link on interaction */ link?: string | null; }; /** Send messages */ export declare class Notifications extends PathEventEmitter { protected momentum: Momentum; private _enabled; /** Are notifications enabled */ get enabled(): boolean; private set enabled(value); /** Get Push Subscription info */ get subscription(): Promise<PushSubscription | null>; constructor(momentum: Momentum); /** * Send a notification * @param {Notification} notification Notification that will be sent to user * @return {Promise<void>} Returns once complete */ create(notification: Notification): Promise<void>; /** * Disable device notifications * @return {Promise<void>} Resolves on success */ disable(): Promise<void>; /** * Enable device notifications * @return {Promise<null>} Resolves on success */ enable(): Promise<null>; } //# sourceMappingURL=notifications.d.ts.map