From 7dbb6a5f79e250314cdadf4c08ccd37931a4c1c0 Mon Sep 17 00:00:00 2001 From: "Jorge L. Fatta" Date: Mon, 28 Nov 2016 17:37:45 -0300 Subject: [PATCH] added notifications --- renderer.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/renderer.js b/renderer.js index 3964259..f2aba8c 100644 --- a/renderer.js +++ b/renderer.js @@ -22,6 +22,15 @@ ipcRenderer.on('did-finish-load', () => { ipcRenderer.on('processing-did-succeed', (event, secret) => { inputs.result.value = secret + var notif = new window.Notification('Secret fetched', { + body: `the secret ${inputs.placeholder.value} was sucessfully fetched.`, + silent: true // We'll play our own sound + }) + + // If the user clicks in the Notifications Center, show the app + notif.onclick = function () { + ipcRenderer.send('focusWindow', 'main') + } }) ipcRenderer.on('processing-did-fail', (event, error) => { @@ -38,4 +47,14 @@ form.addEventListener('submit', (event) => { buttons.copyToClipboard.addEventListener('click', () => { console.log('copying ', inputs.result.value) clipboard.writeText(inputs.result.value) + + var notif = new window.Notification('Secret copied', { + body: `the secret ${inputs.placeholder.value} was copied to clipboard.`, + silent: true // We'll play our own sound + }) + + // If the user clicks in the Notifications Center, show the app + notif.onclick = function () { + ipcRenderer.send('focusWindow', 'main') + } })