Use LocalStorage as database

Hi , I want to make an offline application where I can storage info based on labels added by the user.The thing is , I want all these infos to be stored in the local database and to be read as soon as the app starts.I am almost at the peak of the solution but everytime i refresh the app only the last item is shown , the others are deleted.Here is the code,can u tell me where my mistake is?

var Observable = require('FuseJS/Observable');
var Storage = require("FuseJS/Storage");
var tabs = Observable();
var name = Observable();
var series = Observable();
var reps = Observable();
var weigth = Observable();
var oldData = Observable();
this.onParameterChanged(function(param) {
	console.log("Ova e DATA OD param: " + JSON.stringify(param.data));
	if(param.data != null)
	{
		tabs.add(param.data[0]);
		oldData.value = param.data[0];
	}
});

tabs.add(oldData.value);

I am so sorry , that was old code.Here is the updated…

var Observable = require('FuseJS/Observable');
var Storage = require("FuseJS/Storage");
var tabs = Observable();
var name = Observable();
var series = Observable();
var reps = Observable();
var weigth = Observable();
var oldData = Observable();
var addData=Observable();
this.onParameterChanged(function(param) {
	console.log("Ova e DATA OD param: " + JSON.stringify(param.data));
	if(param.data != null)
	{
		tabs.add(param.data[0]);
		//oldData.value = param.data[0];
		Storage.write("Training" , param.data[0]);
	}
});
 addData.value = Storage.readSync("Training");
tabs.add(addData.value);
tabs.add(oldData.value);

function remove()
{
	tabs.remove();
}

This line

Storage.write("Training" , param.data[0]);

writes a single value to your “Training” file. That probably explains it.

To provide meaningful help, we would need you to post a complete, minimal reproduction that we can copy-paste and run.

Hi Pedrag

We are using in production this javascript database:

It works just out of the box and it is very fast.