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