mirror of
https://github.com/fergalmoran/dss.git
synced 2026-01-06 17:04:30 +00:00
30 lines
710 B
JavaScript
Executable File
30 lines
710 B
JavaScript
Executable File
/** @license
|
|
|
|
----------------------------------------------
|
|
|
|
Copyright (c) 2012, Fergal Moran. All rights reserved.
|
|
Code provided under the BSD License:
|
|
|
|
*/
|
|
if (!com) var com = {};
|
|
if (!com.podnoms) com.podnoms = {};
|
|
Storage.prototype.setObject = function(key, value) {
|
|
this.setItem(key, JSON.stringify(value));
|
|
};
|
|
|
|
Storage.prototype.getObject = function(key) {
|
|
var value = this.getItem(key);
|
|
return value && JSON.parse(value);
|
|
};
|
|
|
|
com.podnoms.storage = {
|
|
setItem: function(key, value){
|
|
localStorage.setItem(key, value);
|
|
},
|
|
getItem: function(key){
|
|
return localStorage.getItem(key);
|
|
},
|
|
clearItem: function(key){
|
|
localStorage.removeItem(key);
|
|
}
|
|
}; |