notification.js
notification.js copied to clipboard
Differentiate between "not allowed" and "denied"
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
Seems reasonable, open to Pull Request