diff --git a/app/render/notification.js b/app/render/notification.js new file mode 100644 index 0000000..58cee82 --- /dev/null +++ b/app/render/notification.js @@ -0,0 +1,18 @@ +var remote = require('electron').remote; + +function listenNotification() { + remote.getCurrentWindow().webContents.executeJavaScript( + 'new Promise((resolve, reject) => { if (SESSION) { console.log("SESSION avail"); SESSION.on("notificationClick", function () { resolve(); }); } });' + ).then(() => { + remote.app.emit('activate'); + listenNotification(); + }); +} + +function setupNotificationHandler() { + document.addEventListener("DOMContentLoaded", function (event) { + listenNotification(); + }); +} + +module.exports = setupNotificationHandler; \ No newline at end of file diff --git a/app/render/preload.js b/app/render/preload.js index 4bac9b5..b065332 100644 --- a/app/render/preload.js +++ b/app/render/preload.js @@ -24,6 +24,7 @@ require('./focus')(); require('./zoom')(); require('./spellcheck')(); + require('./notification')(); require('./irc-url')(); require('./user')();