News for hackers. Stuff that matters.
Re:Swarm.js and React – Real-time, offline-ready web apps by hackerboos on Tuesday October 14, 2014 @09:20AM (#8453247)
It always annoys me when SPAs don't allow me to do basic things when I lose my connection.

Webstorage has excellent browser support but isn't utilised enough (http://caniuse.com/#search=webstorage)

Re:Swarm.js and React – Real-time, offline-ready web apps by jackmoore on Tuesday October 14, 2014 @09:56AM (#8453395)
Webstorage is a bit handicapped for SPAs. There is a 5MB size cap, and you can only store strings. It's nice as a cookie replacement, but the limitations hurt for anything more advanced. IndexedDB resolves these issues while also being fairly well supported.
Re:Swarm.js and React – Real-time, offline-ready web apps by binarymax on Tuesday October 14, 2014 @10:16AM (#8453496)
IndexedDB has terrible support. Sadly LocalStorage is the only reliably supported option right now. I really hope in 6 months this comment is wrong.

--EDIT-- sorry @untog, I replied to the wrong comment and deleted before as you replied.

Re:Swarm.js and React – Real-time, offline-ready web apps by Bahamut on Tuesday October 14, 2014 @11:05AM (#8453724)
Use a library that uses IndexedDB and uses WebSQL as a fallback then.
Re:Swarm.js and React – Real-time, offline-ready web apps by jbergens on Thursday October 16, 2014 @08:40AM (#8464570)
This is what we do and it worked great until iOS8 came along. Read more about some problems here http://www.raymondcamden.com/2014/9/25/IndexedDB-on-iOS-8--B...
Re:Swarm.js and React – Real-time, offline-ready web apps by binarymax on Tuesday October 14, 2014 @11:35AM (#8453869)
The Web SQL Database specification is no longer being maintained and support may be dropped in future versions.

Also - these fallbacks are not exactly swappable. Its like swapping from a Database to a Filesystem as a fallback. Difficult to abstract into a single library/api.

And you still potentially leave out IE users if those are your options (depending on your IndexedDB needs).

IndexedDB to localStorage fallback might work - but again might not be an easy API abstraction.

Re:Swarm.js and React – Real-time, offline-ready web apps by hodoublesy on Tuesday October 14, 2014 @01:09PM (#8454446)
I have had good luck with https://github.com/mozilla/localForage as an API abstraction
Re:Swarm.js and React – Real-time, offline-ready web apps by nolanl on Tuesday October 14, 2014 @02:00PM (#8454739)
PouchDB, ydn-db, IndexedDBShim, and Lawnchair will do this as well.

Web SQL may be "deprecated," but it's unlikely to be dropped by Apple or Google, since so many mobile web apps depend on it. Even the mobile version of Gmail uses Web SQL.

Re:Swarm.js and React – Real-time, offline-ready web apps by kxo on Tuesday October 14, 2014 @09:43PM (#8456813)
I wonder if asm.js + the sqlite3 driver + localstorage would suffice.. it would certainly be interesting.
Re:Swarm.js and React – Real-time, offline-ready web apps by xtrumanx on Tuesday October 14, 2014 @11:32AM (#8453855)
> .. and you can only store strings

That's isn't much of a problem with JSON.strigify and JSON.strigify.

Re:Swarm.js and React – Real-time, offline-ready web apps by masklinn on Tuesday October 14, 2014 @12:40PM (#8454263)
Except that eats into your already small storage quota, and burns CPU.