event subscriptions
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
type USVString = string;
|
||||
type DOMString = string;
|
||||
type DOMTimeStamp = number;
|
||||
|
||||
export interface NotificationAction {
|
||||
/** A string identifying a user action to be displayed on the notification. */
|
||||
action: string;
|
||||
|
||||
/** A string containing action text to be shown to the user. */
|
||||
title: string;
|
||||
|
||||
/** A string containing the URL of an icon to display with the action. */
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
export enum NotificationActionOperation {
|
||||
/** Opens a new tab at the specified URL. */
|
||||
OPEN_WINDOW = "openWindow",
|
||||
|
||||
/** Focuses the last focused client. If there is no client open, then it opens a new tab at the specified URL. */
|
||||
FOCUS_LAST_FOCUSED_OR_OPEN = "focusLastFocusedOrOpen",
|
||||
|
||||
/** Focuses the last focused client and navigates it to the specified URL. If there is no client open, then it opens a new tab at the specified URL. */
|
||||
NAVIGATE_LAsT_FOCUSED_OR_OPEN = "navigateLastFocusedOrOpen",
|
||||
|
||||
/** Send a simple GET request to the specified URL. */
|
||||
SEND_REQUEST = "sendRequest",
|
||||
}
|
||||
|
||||
interface NotificationDataAction {
|
||||
operation: NotificationActionOperation;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export interface ActionClickHandler {
|
||||
default: NotificationDataAction;
|
||||
[key: string]: NotificationDataAction;
|
||||
}
|
||||
|
||||
export interface NotificationData {
|
||||
onActionClick?: ActionClickHandler;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface AngularPushPayload {
|
||||
/** https://developer.mozilla.org/en-US/docs/Web/API/Notification */
|
||||
notification: {
|
||||
/** Declares actions handled in data.onActionClick[action] */
|
||||
readonly actions?: NotificationAction[];
|
||||
|
||||
/** A string containing the URL of an image to represent the notification when there is not enough space to display the notification itself such as for example, the Android Notification Bar. On Android devices, the badge should accommodate devices up to 4x resolution, about 96 by 96 px, and the image will be automatically masked. */
|
||||
readonly badge?: USVString;
|
||||
|
||||
/** indicates the body string of the notification */
|
||||
readonly body?: DOMString;
|
||||
|
||||
/** The data read-only property of the Notification interface returns a structured clone of the notification's data */
|
||||
readonly data?: NotificationData;
|
||||
|
||||
/** The text direction of the notification */
|
||||
readonly dir?: "auto" | "ltr" | "rtl";
|
||||
|
||||
/** The URL of the image used as an icon of the notification */
|
||||
readonly icon?: USVString;
|
||||
|
||||
/** The URL of an image to be displayed as part of the notification */
|
||||
readonly image?: USVString;
|
||||
|
||||
/** The language code of the notification (BCP 47 language tag) */
|
||||
readonly lang?: DOMString;
|
||||
|
||||
/** Specifies whether the user should be notified after a new notification replaces an old one. */
|
||||
readonly renotify?: boolean;
|
||||
|
||||
/** A boolean value indicating that a notification should remain active until the user clicks or dismisses it, rather than closing automatically. */
|
||||
readonly requireInteraction?: boolean;
|
||||
|
||||
/** Specifies whether the notification should be silent — i.e., no sounds or vibrations should be issued regardless of the device settings. */
|
||||
readonly silent?: boolean;
|
||||
|
||||
/** The idea of notification tags is that more than one notification can share the same tag, linking them together. One notification can then be programmatically replaced with another to avoid the users' screen being filled up with a huge number of similar notifications. */
|
||||
readonly tag?: DOMString;
|
||||
|
||||
/** The notification's timestamp can represent the time, in milliseconds since 00:00:00 UTC on 1 January 1970, of the event for which the notification was created, or it can be an arbitrary timestamp that you want associated with the notification. For example, a timestamp for an upcoming meeting could be set in the future, whereas a timestamp for a missed message could be set in the past. */
|
||||
readonly timestamp?: DOMTimeStamp | undefined;
|
||||
|
||||
/** The title of the notification */
|
||||
readonly title: DOMString;
|
||||
|
||||
/** Specifies a vibration pattern for devices with vibration hardware to emit. */
|
||||
readonly vibrate?: number[];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user