Skip to content

Commit

Permalink
Sending a window.Notification
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrieseberg committed Aug 31, 2017
1 parent c199638 commit 73d3f71
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/renderer/renderer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
const loadMonaco = require('monaco-loader')

function sendNotification (editor) {
const notification = new window.Notification('Hello!', {
body: 'Hello from your notification system'
})

notification.onclick = () => {
editor.setValue('Notification clicked!')
}
}

loadMonaco().then((monaco) => {
const element = document.querySelector('#container')
const options = {
Expand All @@ -9,4 +19,15 @@ loadMonaco().then((monaco) => {
}

const editor = monaco.editor.create(element, options)

// Send a pointless little notification
editor.addAction({
id: 'send-notifications',
label: 'Send notification...',
contextMenuGroupId: 'navigation',
contextMenuOrder: 1,
precondition: null,
keybindingContext: null,
run: (editor) => sendNotification(editor)
})
})

0 comments on commit 73d3f71

Please sign in to comment.