summaryrefslogtreecommitdiffhomepage
path: root/flow-libs
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-01 17:32:52 -0300
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-08-08 08:12:47 -0300
commitb7fccae454943a113022fe4403ca9a6920ffec13 (patch)
tree8bcc6709f88652f47bfc9434acc1f6d1291c2af6 /flow-libs
parent2c4d95cea476a0f038b731e13088d547465971c3 (diff)
downloadmullvadvpn-b7fccae454943a113022fe4403ca9a6920ffec13.tar.xz
mullvadvpn-b7fccae454943a113022fe4403ca9a6920ffec13.zip
Implement system notifications of connection state
Diffstat (limited to 'flow-libs')
-rw-r--r--flow-libs/notification.js.flow51
1 files changed, 51 insertions, 0 deletions
diff --git a/flow-libs/notification.js.flow b/flow-libs/notification.js.flow
new file mode 100644
index 0000000000..bf5dda3af2
--- /dev/null
+++ b/flow-libs/notification.js.flow
@@ -0,0 +1,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;
+}