Useful for interacting with a persistent namespaced object store within localStorage without messing with anything else that might be there (like on *.github.io).
var store = new TinyStore('memories')
store.enabled
// -> true (you've got localStorage!)
store.get('saturday')
// -> undefined
store.set('saturday', 'karaoke')
// -> 'karaoke'
store.set('sunday', ['hangover', 'NaptimePDX'])
// -> ["hangover", "NaptimePDX"]
store.set('monday', { 'work': ['meetings', 'coding'] })
// -> { "work": ["meetings", "coding"] }
store.session
// -> { "saturday": "karaoke", "sunday": ["hangover", "NaptimePDX"], "monday": { "work": ["meetings", "coding"] } }
// you can manipulate the session object directly if that's your jam
store.session.whatever = { 'doge': 'sweater vests' }
store.save()
// -> { "saturday": "karaoke", "sunday": ["hangover", "NaptimePDX"], "monday": { "work": ["meetings", "coding"] }, "whatever": { "doge": "sweater vests" } }
store.remove('whatever')
// -> { "saturday": "karaoke", "sunday": ["hangover", "NaptimePDX"], "monday": { "work": ["meetings", "coding"] } }
store.clear()
// -> {}
Now a real thing! https://github.com/ngoldman/tinystore