notification.js icon indicating copy to clipboard operation
notification.js copied to clipboard

Differentiate between "not allowed" and "denied"

Open ehq opened this issue 10 years ago • 1 comments

Right now checking permissions (on browsers that support it) returns a kind of binary response, either "granted" or "denied": https://github.com/MrSwitch/notification.js/blob/master/notification.js#L97

The problem with that is that there are cases where it's useful to differentiate why notifications are not currently allowed.

  • If the user still hasn't either allowed or denied desktop notifications, then I want to request permission to show them notifications.
  • If the user refused allowing desktop notifications then I don't want to bother them by asking for permission again.

I think Notification.permission could return these possible values (just as an example):

  • unknown
  • enabled
  • disabled
  • denied

ehq avatar Feb 11 '14 20:02 ehq

Seems reasonable, open to Pull Request

MrSwitch avatar Feb 13 '14 00:02 MrSwitch