copay/test/FakeStorage.js

27 lines
541 B
JavaScript
Raw Normal View History

2014-03-26 13:55:02 -07:00
var FakeStorage = function(){
this.storage = {};
};
2014-04-15 10:55:09 -07:00
FakeStorage.prototype.setGlobal = function (id, payload) {
2014-04-09 10:30:12 -07:00
this.storage[id] = payload;
2014-03-26 13:55:02 -07:00
};
2014-04-15 10:55:09 -07:00
FakeStorage.prototype.getGlobal = function(id) {
2014-04-09 10:30:12 -07:00
return this.storage[id];
2014-03-26 13:55:02 -07:00
}
2014-04-15 10:55:09 -07:00
FakeStorage.prototype.set = function (wid, id, payload) {
this.storage[wid + '-' + id] = payload;
};
FakeStorage.prototype.get = function(wid, id) {
return this.storage[wid + '-' +id];
}
FakeStorage.prototype.clear = function() {
delete this['storage'];
}
2014-03-26 13:55:02 -07:00
module.exports = require('soop')(FakeStorage);