forked from extern/egroupware
Check and ask for the notification permission if nothing yet set
This commit is contained in:
parent
77c1d67240
commit
77cd21c46b
@ -93,10 +93,16 @@ egw.extend('notification', egw.MODULE_WND_LOCAL, function(_app, _wnd)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Check Notification availability by browser
|
* Check Notification availability by browser
|
||||||
*
|
*
|
||||||
* @returns {Boolean} true if notification is supported and permitted otherwise false
|
* @returns {Boolean} true if notification is supported and permitted otherwise false
|
||||||
*/
|
*/
|
||||||
checkNotification: function () {
|
checkNotification: function () {
|
||||||
|
// Ask for permission if there's nothing decided yet
|
||||||
|
if (Notification && Notification.requestPermission && permission == 'default') {
|
||||||
|
Notification.requestPermission (function(_permission){
|
||||||
|
permission = _permission;
|
||||||
|
});
|
||||||
|
}
|
||||||
return (Notification && Notification.requestPermission && permission == 'granted');
|
return (Notification && Notification.requestPermission && permission == 'granted');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user