This commit is contained in:
Matias Alejo Garcia 2014-07-08 20:05:41 -03:00
parent 248c18596c
commit 7a072e83d9
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
//localstorage Mock
ls = {};
function LocalStorage(opts) {}
FakeLocalStorage = {};
FakeLocalStorage.length = 0;
FakeLocalStorage.removeItem = function(key) {
delete ls[key];
this.length = Object.keys(ls).length;
};
FakeLocalStorage.getItem = function(k) {
return ls[k];
};
FakeLocalStorage.key = function(i) {
return Object.keys(ls)[i];
};
FakeLocalStorage.setItem = function(k, v) {
ls[k] = v;
this.key[this.length] = k;
this.length = Object.keys(ls).length;
};
module.exports = require('soop')(FakeLocalStorage);