diff options
Diffstat (limited to 'src/webview')
-rw-r--r-- | src/webview/notifications.js | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/webview/notifications.js b/src/webview/notifications.js index 205a3220c..22960d818 100644 --- a/src/webview/notifications.js +++ b/src/webview/notifications.js | |||
@@ -1,22 +1,26 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | import uuidV1 from 'uuid/v1'; | 2 | |
3 | import { v1 as uuidV1 } from 'uuid'; | ||
3 | 4 | ||
4 | const debug = require('debug')('Ferdi:Notifications'); | 5 | const debug = require('debug')('Ferdi:Notifications'); |
5 | 6 | ||
6 | export class NotificationsHandler { | 7 | export class NotificationsHandler { |
7 | onNotify = (data) => data; | 8 | onNotify = data => data; |
8 | 9 | ||
9 | displayNotification(title, options) { | 10 | displayNotification(title, options) { |
10 | return new Promise((resolve) => { | 11 | return new Promise(resolve => { |
11 | debug('New notification', title, options); | 12 | debug('New notification', title, options); |
12 | 13 | ||
13 | const notificationId = uuidV1(); | 14 | const notificationId = uuidV1(); |
14 | 15 | ||
15 | ipcRenderer.sendToHost('notification', this.onNotify({ | 16 | ipcRenderer.sendToHost( |
16 | title, | 17 | 'notification', |
17 | options, | 18 | this.onNotify({ |
18 | notificationId, | 19 | title, |
19 | })); | 20 | options, |
21 | notificationId, | ||
22 | }), | ||
23 | ); | ||
20 | 24 | ||
21 | ipcRenderer.once(`notification-onclick:${notificationId}`, () => { | 25 | ipcRenderer.once(`notification-onclick:${notificationId}`, () => { |
22 | resolve(); | 26 | resolve(); |