Looking to extend small timer app with auto-save functionality | Bounty + $25
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I have a small timer app that saves its state as a JSON file. I'd like to replace the save functionality with something more automatic to make using the app easier. Ideally, the JSON would be saved somewhere and then fetched on app-open (and persist through clearing my browser's cache). If I have to host the app on a small web server, that's okay, but ideally I'd just run it on my desktop.

Kudos CyteBode for putting together the following; it's a real cool piece of software. I look forward to seeing what you all come up with. Please let me know if I can provide any more info. I'm posting this as $1 and will tip $25 for a working solution. It may take a few days for me to send this tip, but if you look at my history here you'll see that I'm good for it. Thanks, and here's the code:


If it would be running in a navigator, it means using cookies (you mentioned a server host), or much more simpler, using local storage to save json file there (cookies normally used for small variables). Tell me if these options fits your use cases.
Chlegou 5 months ago
Both sound great, but something that'd save the JSON locally automatically might be better as it sounds like it'd work even if my cache is cleared. It'd just need to be able to open the saved cache on app open? I hope this makes sense.
sharper 5 months ago
awarded to farolanf

Crowdsource coding tasks.

2 Solutions

Winning solution

Here's a simple auto save using local storage http://jsfiddle.net/farolan/32cnaotw/

This looks great, does this store data without a browser cache? Would it persist through clearing my cache?
sharper 5 months ago
No it doesn't. For that you would need a web server. A simple local node expressjs is enough.
farolanf 5 months ago
Okay, thank you! Oddly, it seems that if I clear all of my cache from Chrome that the JSFiddle maintains the info. How does that work?
sharper 5 months ago
Maybe it's because the script runs on different domain. The one that cleared is jsfiddle.net but the domain the app running is fiddle.jshell.net.
farolanf 5 months ago
@sharper It's because you're not clearing your cache properly. In Chrome, you need to make sure "Cookies and other site data" is ticked when clearing browser data, in which case the local storage does not persist. Neither cookies nor local storage are a good solution if you want it to persist through clearing your cache properly. Edit: It might also because you're signed into a Google account and it's being synced through that, but I haven't tried it.
CyteBode 5 months ago
@CyteBode Oh okay. You are right and I think it may be the latter because I did clear every cache option in Chrome. Wondering how I might achieve this; maybe a small web app with a login mechanism so that it can store my user state or something.Though, that may be overkill? Hmmm.
sharper 5 months ago
Did you try my other solution below?
farolanf 5 months ago
Hey, I just did. It seems to work great! Where is the JSON/state stored? Do I need to just fire up the server when I want to use it? Is there a way to maybe automate this some so that I just open it like an app? Thank you
sharper 5 months ago
The timers.json is stored in the ./public folder. You could create a shortcut on your desktop that run something like npm start& google-chrome http://localhost:3100.
farolanf 5 months ago
Beautiful. Thank you
sharper 5 months ago
Tip sent! Thanks for your patience
sharper 5 months ago
View Timeline