3 ms·
Personally, I wouldn't use a library at all unless I had to support IE<8. Localstorage is supported enough across browsers: http://caniuse.com/#feat=namevalue-
by hackerboos 10y ago
Personally, I wouldn't use a library at all unless I had to support IE<8. Localstorage is supported enough across browsers:
http://caniuse.com/#feat=namevalue-storage http://caniuse.com/#feat=namevalue-storage
- vanderZwan 10y agoWell, I need more than 5 MB and would like to store other values than strings (mostly large TypedArrays). Something simplifying my life there would be appreciated.
- hackerboos 10y agoJSON.stringify/JSON.parse before getting/setting from localstorage. The other requirements localstorage alone can't address.
- marcuswestin 10y agoI think something like store.js ends up being genuinely useful for anyone building functionality that depends on localStorage. More often than not you find yourself either having to deal with issues that store.js solves for you (E.g not breaking your site in Safari private mode) or requiring extra functionality that already exists as a small store.js plugin. (E.g expiring keys, default values, etc). All of these are things you can of course do without a library, but at that point you're reinventing the wheel a bit and not benefitting from all the automated testing that ensures cross-browser correctness. With that said, I agree there are times when just a quick read/write directly to localStorage can be the right call, but by default I think it comes back to bite you one way or another more often than not :)
- couchand 10y agoIt's worth noting that vanderZwan was asking about localForage, the library by Mozilla, not localStorage, the browser feature.
- hackerboos 10y agoI'm aware of that. I'm saying if that your use case is simply to write to localstorage then a wrapper library is unnecessary.