added support for localstorage
This commit is contained in:
parent
910906664c
commit
c08eda28ab
6 changed files with 96 additions and 38 deletions
22
js/services/storage.js
Normal file
22
js/services/storage.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.storage')
|
||||
.factory('Storage', function($rootScope) {
|
||||
return {
|
||||
get: function(key) {
|
||||
return JSON.parse(localStorage.getItem(key));
|
||||
},
|
||||
|
||||
save: function(key, data) {
|
||||
localStorage.setItem(key, JSON.stringify(data));
|
||||
},
|
||||
|
||||
remove: function(key) {
|
||||
localStorage.removeItem(key);
|
||||
},
|
||||
|
||||
clearAll: function() {
|
||||
localStorage.clear();
|
||||
}
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue