1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
/* Notification */
type NotificationPermission = 'default' | 'denied' | 'granted';
type NotificationDirection = 'auto' | 'ltr' | 'rtl';
type VibratePattern = number | Array<number>;
type NotificationAction = { action: string, title: string, icon?: string };
type NotificationOptions = {
dir: NotificationDirection,
lang: string,
body: string,
tag: string,
image: string,
icon: string,
badge: string,
sound: string,
vibrate: VibratePattern,
timestamp: number,
renotify: boolean,
silent: boolean,
requireInteraction: boolean,
data: ?any,
actions: Array<NotificationAction>,
};
declare class Notification extends EventTarget {
constructor(title: string, options?: $Shape<NotificationOptions>): void;
static permission: NotificationPermission;
static requestPermission(
callback?: (perm: NotificationPermission) => mixed,
): Promise<NotificationPermission>;
static maxActions: number;
onclick: (evt: Event) => any;
onerror: (evt: Event) => any;
title: string;
dir: NotificationDirection;
lang: string;
body: string;
tag: string;
image: string;
icon: string;
badge: string;
sound: string;
vibrate: Array<number>;
timestamp: number;
renotify: boolean;
silent: boolean;
requireInteraction: boolean;
data: any;
actions: Array<NotificationAction>;
close(): void;
}
|