HTML5 Desktop Notifications (ideally with Angular) HTML5 Desktop Notifications (ideally with Angular) reactjs reactjs

HTML5 Desktop Notifications (ideally with Angular)


To clarify I mean a front end solution. However I came across this, which I have edited down and improved.

This is plain JavaScript for clarity, I will be using some of my own methods to link it to Angular.

document.addEventListener('DOMContentLoaded',function(){document.getElementById('notifyButton').addEventListener('click',function(){    if(! ('Notification' in window) ){        console.log('Web Notification not supported');        return;    }       Notification.requestPermission(function(permission){            var notification = new Notification("Title",{body:'HTML5 Web Notification API',icon:'http://i.stack.imgur.com/Jzjhz.png?s=48&g=1', dir:'auto'});            setTimeout(function(){                notification.close();            },3000);        });    });});


Use node notifier module. Of course it's server side only.

var notifier = require('node-notifier');notifier.notify({    title: 'Title',    message: 'Message'}, function(err, resp) {    if(err) {        console.log(err);    }});