Added a util function that checks that local/session storage is enabled. Also added tests using this function to report an error to the user if it is not enabled
Этот коммит содержится в:
@@ -96,6 +96,21 @@ module.exports.getCookie = function(name) {
|
||||
if (parts.length == 2) return parts.pop().split(";").shift();
|
||||
}
|
||||
|
||||
module.exports.isLocalStorageSupported = function() {
|
||||
try {
|
||||
sessionStorage.setItem("testSession", '1');
|
||||
sessionStorage.removeItem("testSession");
|
||||
|
||||
localStorage.setItem("testLocal", '1');
|
||||
localStorage.removeItem("testLocal", '1');
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.notifyMe = function(title, body, channel) {
|
||||
if ("Notification" in window && Notification.permission !== 'denied') {
|
||||
Notification.requestPermission(function (permission) {
|
||||
|
||||
Ссылка в новой задаче
Block a user