Remove OC.localStorage and object method

* use the localstorage APIs of the browser instead
* use new Object() instead

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2016-10-20 12:16:44 +02:00
parent 19b69cbf1b
commit 33c3293d05
No known key found for this signature in database
GPG key ID: 9CE5ED29E7FCD38A

View file

@ -1305,82 +1305,6 @@ OC.Breadcrumb={
} }
}; };
if(typeof localStorage !=='undefined' && localStorage !== null){
/**
* User and instance aware localstorage
* @namespace
*/
OC.localStorage={
namespace:'oc_'+OC.currentUser+'_'+OC.webroot+'_',
/**
* Whether the storage contains items
* @param {string} name
* @return {boolean}
*/
hasItem:function(name){
return OC.localStorage.getItem(name)!==null;
},
/**
* Add an item to the storage
* @param {string} name
* @param {string} item
*/
setItem:function(name,item){
return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item));
},
/**
* Removes an item from the storage
* @param {string} name
* @param {string} item
*/
removeItem:function(name,item){
return localStorage.removeItem(OC.localStorage.namespace+name);
},
/**
* Get an item from the storage
* @param {string} name
* @return {null|string}
*/
getItem:function(name){
var item = localStorage.getItem(OC.localStorage.namespace+name);
if(item === null) {
return null;
} else {
return JSON.parse(item);
}
}
};
}else{
//dummy localstorage
OC.localStorage={
hasItem:function(){
return false;
},
setItem:function(){
return false;
},
getItem:function(){
return null;
}
};
}
/**
* prototypical inheritance functions
* @todo Write documentation
* usage:
* MySubObject=object(MyObject)
*/
function object(o) {
function F() {}
F.prototype = o;
return new F();
}
/** /**
* Initializes core * Initializes core
*/ */