Add a method to egw.notification to check API availability

This commit is contained in:
Hadi Nategh 2016-07-11 12:01:09 +02:00
parent d054aa90f5
commit 77c1d67240

View File

@ -89,6 +89,15 @@ egw.extend('notification', egw.MODULE_WND_LOCAL, function(_app, _wnd)
// Callback function dispatches on error
notification.onerror = options.onerror || function (e) {egw.debug('Notification failed because of ' + e);};
},
/**
* Check Notification availability by browser
*
* @returns {Boolean} true if notification is supported and permitted otherwise false
*/
checkNotification: function () {
return (Notification && Notification.requestPermission && permission == 'granted');
}
};