Skip to content

Instantly share code, notes, and snippets.

@greemwahr
Created February 18, 2017 18:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greemwahr/d915ad4f950d23953ba4e2d6d60bf6ce to your computer and use it in GitHub Desktop.
Save greemwahr/d915ad4f950d23953ba4e2d6d60bf6ce to your computer and use it in GitHub Desktop.
Vue component for desktop notification
Vue.component('desktop-notificator', {
props: ['message', 'title'],
template: '<button v-on:click="notify()">??</button>',
methods: {
notify: function() {
if (Notification.permission !== "granted") {
Notification.requestPermission();
} else {
new Notification(this.title, {
body: this.message,
})
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment