How to clear chrome.storage.local and chrome.storage.sync?
Use chrome.storage.local.clear() and chrome.storage.sync.clear()
The API is asynchronous so to do subsequent actions to the storage, use a callback:
chrome.storage.local.clear(function() {
var error = chrome.runtime.lastError;
if (error) {
console.error(error);
}
// do something more
});
chrome.storage.sync.clear(); // callback is optional
You can also use chrome.storage.local.remove() method if you want to remove any specific or list of specific object from Storage
chrome.storage.local.remove(["Key1","key2"],function(){
var error = chrome.runtime.lastError;
if (error) {
console.error(error);
}
})