added notifications

This commit is contained in:
Abhinav Adduri 2017-06-21 13:23:36 -07:00
parent 37f74cacfa
commit c9da5b8078
4 changed files with 23 additions and 3 deletions

View file

@ -20,7 +20,21 @@ function strToIv(str) {
return iv;
}
function notify(str) {
if (!("Notification" in window)) {
return;
} else if (Notification.permission === 'granted') {
new Notification(str)
} else if (Notification.permission !== 'denied') {
Notification.requestPermission(function(permission) {
if (permission === 'granted')
new Notification(str);
})
}
}
module.exports = {
ivToStr,
strToIv
strToIv,
notify
};