aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview')
-rw-r--r--src/webview/notifications.js19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/webview/notifications.js b/src/webview/notifications.js
index 205a3220c..73cdb89d4 100644
--- a/src/webview/notifications.js
+++ b/src/webview/notifications.js
@@ -1,22 +1,25 @@
1import { ipcRenderer } from 'electron'; 1import { ipcRenderer } from 'electron';
2import uuidV1 from 'uuid/v1'; 2import { v1 as uuidV1 } from 'uuid';
3 3
4const debug = require('debug')('Ferdi:Notifications'); 4const debug = require('debug')('Ferdi:Notifications');
5 5
6export class NotificationsHandler { 6export 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('notification', this.onNotify({ 15 ipcRenderer.sendToHost(
16 title, 16 'notification',
17 options, 17 this.onNotify({
18 notificationId, 18 title,
19 })); 19 options,
20 notificationId,
21 }),
22 );
20 23
21 ipcRenderer.once(`notification-onclick:${notificationId}`, () => { 24 ipcRenderer.once(`notification-onclick:${notificationId}`, () => {
22 resolve(); 25 resolve();