Wallet/js/models/Storage.js

26 lines
472 B
JavaScript
Raw Normal View History

2014-04-07 14:36:57 -03:00
'use strict';
var imports = require('soop').imports();
function Storage() {
this.data = {};
}
2014-04-08 00:54:38 -03:00
Storage.prototype.get = function(k) {
2014-04-08 18:35:43 -03:00
return JSON.parse(localStorage.getItem(k));
2014-04-07 14:36:57 -03:00
};
2014-04-08 00:54:38 -03:00
Storage.prototype.set = function(k,v) {
2014-04-08 18:35:43 -03:00
localStorage.setItem(k, JSON.stringify(v));
2014-04-07 14:36:57 -03:00
};
2014-04-08 18:35:43 -03:00
Storage.prototype.remove = function(k) {
localStorage.removeItem(k);
};
2014-04-07 14:36:57 -03:00
2014-04-08 18:35:43 -03:00
Storage.prototype.clearAll = function() {
localStorage.clear();
};
2014-04-07 14:36:57 -03:00
module.exports = require('soop')(Storage);