0

when I close the tab and then open a new one ,all the storage is removed.I am using

var postsId = []
    chrome.storage.local.set({
                'posts': postsId
              }); 

and later I do :

chrome.storage.local.get({
                    posts: []
                  }, function(result) {
}

is there any other option to save the data without losing it ?

Thank you

Maxim Toyberman
  • 1,906
  • 1
  • 20
  • 35
  • The question isn't answerable in its current state. Edit it and add the relevant code. Most probably, you're using the asynchronous chrome.storage API [incorrectly](https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call). – wOxxOm Aug 07 '16 at 10:40

2 Answers2

0

If you access it immediately after you saved it, it works? Maybe you're trying to store a large item and it returns an error?

itayad
  • 289
  • 2
  • 10
0

This was a stupid mistake .....

var postsId = []

was resetting the array each time...

Maxim Toyberman
  • 1,906
  • 1
  • 20
  • 35