improve code structure in localscoremanager

This commit is contained in:
Gabriele Cirulli
2014-03-12 13:35:42 +01:00
parent 88278792be
commit 608ca2844b
+13 -6
View File
@@ -1,14 +1,21 @@
window.fakeStorage = { window.fakeStorage = {
_data : {}, _data: {},
setItem : function (id, val) {
console.log("set"); setItem: function (id, val) {
return this._data[id] = String(val); return this._data[id] = String(val);
}, },
getItem : function (id) {
getItem: function (id) {
return this._data.hasOwnProperty(id) ? this._data[id] : undefined; return this._data.hasOwnProperty(id) ? this._data[id] : undefined;
}, },
removeItem : function (id) { return delete this._data[id]; },
clear : function () { return this._data = {}; } removeItem: function (id) {
return delete this._data[id];
},
clear: function () {
return this._data = {};
}
}; };
function LocalScoreManager() { function LocalScoreManager() {