in javascript/restrict-deskphone-in-ccp/code.js [32:58]
function browserNotify(msg) {
console.log("Notification called");
// Let's check if the browser supports notifications
if (!("Notification" in window)) {
console.log("Notifications not working");
alert(msg.toString());
}
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification(msg.toString());
}
// Otherwise, we need to ask the user for permission
else if (Notification.permission !== "denied") {
Notification.requestPermission().then(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification(msg.toString());
}
else {
alert(msg.toString());
}
});
}
}