I would like to add a callback to this function: Notification.requestPermission(). The problem is I don't know when exactly it (that function) will be triggered, hence I think I have to bind the browser notification permission box on click or something like that, to achieve that everytime user clicks on "ALLOW", "BLOCK" or "X"(close) the javascript file finds out what button was clicked on and does something like this:
if (result === 'denied')
{
console.log('Permission wasn\'t granted. Allow a retry.');
return;
}
if (result === 'default')
{
console.log('The permission request was dismissed.');
return;
}
if (result === 'accepted')
{
console.log('The permission request was accepted.');
return;
}
My problem is I don't know how it can be binded to that browser notification permission box like the one below ↓
I do not want to call the permission prompt i.e. Notification.requestPermission() function. I just want to detect when Permission was changed and do something with that result.

soo, i'm not entirely sure, if i understand you right, but i don't think you need to bind your stuff to the notification permission box.
According to MDN there are two ways to do this: either use
promises:or the
callbackI think it's more obvious for the promise how to get the value of the permission, but if you'd use a "normal" callback you could wrap your code into a function and check for the permission parameter:
and then call:
then maybe save the result in a global var ( i don't know what you want to do with it, so yeah)