📅  最后修改于: 2022-03-11 14:58:39.677000             🧑  作者: Mango
// Somewhere in your manifest...
{
"permissions": [
"storage"
]
}
// Usage:
// PERSISTENT Storage - Globally
// Save data to storage across their browsers...
chrome.storage.sync.set({ "yourBody": "myBody" }, function(){
// A data saved callback omg so fancy
});
chrome.storage.sync.get(/* String or Array */["yourBody"], function(items){
// items = [ { "yourBody": "myBody" } ]
});
// LOCAL Storage
// Save data to storage locally, in just this browser...
chrome.storage.local.set({ "phasersTo": "awesome" }, function(){
// Data's been saved boys and girls, go on home
});
chrome.storage.local.get(/* String or Array */["phasersTo"], function(items){
// items = [ { "phasersTo": "awesome" } ]
});