chrome extension storage code example
Example 1: how to store edited data of chrome extension locally
{
"permissions": [
"storage"
]
}
chrome.storage.sync.set({ "yourBody": "myBody" }, function(){
});
chrome.storage.sync.get(["yourBody"], function(items){
});
chrome.storage.local.set({ "phasersTo": "awesome" }, function(){
});
chrome.storage.local.get(["phasersTo"], function(items){
});
Example 2: chrome storage for extensions
chrome.storage.sync.set({key: value}, function() { console.log('Value is set to ' + value);});chrome.storage.sync.get(['key'], function(result) { console.log('Value currently is ' + result.key);});