Local Storage

Hi,

I am new to Fuse and I am trying to make a simple note taking app.

I am trying to store the values of the text input in the local storage, and I found the following example in your GitHub page:

That example is working perfectly, but it only renders the stored data after the app has restarted,
I assume is because of the following variable:

var welcomeText = Observable("Loading...");

My question is: how can I change this observable to render the stored data automatically in the app without having to restart it?
Thanks!

Hey.

In this example function saveMessage() just stores input value to localStorage.json. To render stored data, you could modify this function, so after saving data we can update welcomeText value.

function saveMessage() {
    var storeObject = {message: message.value};
    Storage.write(SAVENAME, JSON.stringify(storeObject));
    hasStored.value = true;
    welcomeText.value = "Stored data: "  + message.value;
}

Hope this helps.

Arturs wrote:

Hey.

In this example function saveMessage() just stores input value to localStorage.json. To render stored data, you could modify this function, so after saving data we can update welcomeText value.

function saveMessage() {
    var storeObject = {message: message.value};
    Storage.write(SAVENAME, JSON.stringify(storeObject));
    hasStored.value = true;
    welcomeText.value = "Stored data: "  + message.value;
}

Hope this helps.

I did help man, thanks a lot! sorry I am just replying now - I have been at work all day and just got back to my computer.
Thanks again!