You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
610 B
24 lines
610 B
9 years ago
|
var Storage = (function() {
|
||
|
|
||
|
return {
|
||
|
save: function(key, value) {
|
||
|
return new Promise(function(resolve, reject) {
|
||
|
var objToSave = {};
|
||
|
objToSave[key] = value;
|
||
|
chrome.storage.local.set(objToSave, resolve);
|
||
|
});
|
||
|
},
|
||
|
load: function(key) {
|
||
|
return new Promise(function(resolve, reject) {
|
||
|
chrome.storage.local.get(key, function(data) {
|
||
|
resolve(data[key]);
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
remove: function(key) {
|
||
|
return new Promise(function(resolve, reject) {
|
||
|
chrome.storage.local.remove(key, resolve);
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
})();
|