Reputation: 1636
i have an object which gets updated when ever some data change occurs, i need to store the previous and updating data into an array and retrieve it when required
/* currently i could get 1 data i need multiple data stored to a storage as array*/
get(){
this.storage.get('uploaded').then((data) => {
console.log("get data", JSON.parse(data));
});
}
set(){
var obj = { upload: true,
file: file.audio //this will hold an object which vary when required
}
this.storage.set('uploaded', JSON.stringify( obj ));
}
Upvotes: 2
Views: 763
Reputation: 5229
You could use the push() method of array to update the array with new data.
var obj = new Array();
obj.push();// use this whenever you have new data
and use this to access the values
for (var i in obj) {
//access values using obj[i]
}
Upvotes: 2