Marcos Placona
Marcos Placona
1 min read

Categories

  • Javascript

Tags

  • Website Optimization

Sticky Javascript Persistence

On my last blog post I explained how to create a drag and drop using cloning, so you can can drag & drop multiple objects

I’ve recently been working on a personal project where I need some persistence on the client’s browser.

At first I thought about using Ajax to save at every user interaction, but then I realized it might be a bad idea, as this could possibly result in hundreds (if not thousands) database calls.

I then started to tinker with JavaScript arrays. They are useful but can be a nightmare when they grow too big and need to be updated at specific points.

My last resource would be Twitter, there’s loads of experienced developer there, so why not ask for some advice?

As soon as I posted my question about browser persistence with JavaScript, I got a couple of options from twips, but the one that impressed me the most was @reybango’s suggestion, which is what  I’m gonna be talking about on this very blog post.