Skip to content
Advertisement

chrome.storage.sync.remove array doesn’t work

I am making a small Chrome extension. I would like to use chrome.storage but I can’t get it to delete multiple items (array) from storage. Single item removal works.

JavaScript

Nothing seems to break but the last loop that alerts out what is in the storage still shows all the values I am trying to delete.

Advertisement

Answer

When you pass in a string to sync.remove, Chrome will attempt to remove the one single item whose key matches the input string. If you need to remove multiple items, use an array of key values.

Also, you should move your remove call to inside your get callback.

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement