CSS Style center

CSS Styles, CSS tips

Portfolio

creating a serverless apps with localStorage

Hey fellas,

Im going to explain to you the idea of how to create a native serverless application in javascript.

I will link you to my js fiddle code here, and explain things afterwards

The idea is to

use localStorage

a new feature that modern browsers have, you can check if the browser supports it just by typing if(localStorage) and go on from there.
localStorage based on key value pairs, just like cookies. but he has no expiration date, it can be deleted only if you delete it in the browser settings…

But for my application that wasn’t enough, i needed more than just key value pairs. What i needed is a more extended storage system, and came up with creating a JSON that will be stringified so that i’ll be able to save it as a string to the value of my key, and JSONparse afterwards so that i will be able to use it after i got it back from the storage as a JSON array.

In the code itself you may understand how it’s done, it’s pretty simple. all the data is saved in array, so in order to add new object (new client in my case) to the array i just use myArray.push(newClientObject) so that way i can add as many clients i want to my array and afterwards i can add more properties to that client, be my guest and develop this application further. I would love to see what it’s capable to do… and be sure to keep me posted. ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>