Skip to content

Commit

Permalink
added notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorge L. Fatta committed Nov 28, 2016
1 parent 9f3bea3 commit 7dbb6a5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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')
}
})

0 comments on commit 7dbb6a5

Please sign in to comment.