Retrieve all data from LocalStorage


#1

I’m saving multiple elements to the localstorage and want to retrieve every element when restarting the app. Is that possible? I already tried something like this:

localStorage.setItem(' ' + abstract, ' ' + abstractObject)

 localStorage.forEach(element => {
      console.log(element)
    });

#2

LocalStorage plugin doesn’t allow that, but internally it uses just a file to read / write values. You may simply read that file yourself upon launch of your app.


#3

Thank you!
But I’m still not able to save and read Objects to/from the localStorage.

      let textData = fsa.readText(fileName);
      data =  JSON.parse(textData);
     
      for (let value of Object["values"](data)) {
        console.log(JSON.parse(value.name)); 
      }

object is undefind


#4

Ok there was a issue with storing the data with the plugin so I used fsa.writeText() instead. works now