I am building an add-on as a project for Firefox using JPM and was
wondering how I could enable indefinite permissions for the user?
e.g.
I have the below code which prompts the user for permission on every website:
function HTT(theBody,theIcon,theTitle) {
var options = {
body: theBody,
icon: theIcon
}
if (!(“Notification” in window)) {
alert(“This browser does not support HTT notifications”);
}
else if (Notification.permission === “granted”) {
var n = new Notification(theTitle,options);
Date.now() + 30000;
//setTimeout(n.close.bind(n), 4000);
}
else if (Notification.permission !== ‘denied’) {
Notification.requestPermission(function (permission) {
if (permission === "granted") {
var n = new Notification(theTitle,options);
Date.now() + 30000;
//setTimeout(n.close.bind(n), 4000);
}
});
}
}
What I would like to do is ask for permission once ONLY. How could I achieve this as I have tried a number of different options?
FYI - The purpose of the add-on is the display a notification, but this is the permission side of the code.
Thanks