diff options
Diffstat (limited to 'flow-libs')
| -rw-r--r-- | flow-libs/notification.js.flow | 51 |
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; +} |
