Live data from Hacker News

Basil.js – Smart persistence layer

github.com

11–20 of 24 posts

Re: Basil.js – Smart persistence layer

#13
I would recommend Mozilla's localforage https://github.com/mozilla/localForage. Basil.js takes care of abstracting cookie, session, memory, and localstorage storage options, but localforage provides an abstraction for localStorage, WebSQL, or IndexedDB. With modern applications I find that I often want more storage available. Cookie storage is limited at 4Kb, localStorage (5Mb), sessionStorage (same as localStorage), IndexedDB (50Mb), and WebSQL (50Mb). Localforage will automatically select the best available storage system for the browser. While WebSQL and IndexedDB allow for advanced queries, localforage must cater to the lowest common denominator, localStorage key value pairs. While being restricted to key value pair storage, this is often not a big concern considering how different the WebSQL and IndexedDB APIs are.

Re: Basil.js – Smart persistence layer

#14

I would recommend Mozilla's localforage https://github.com/mozilla/localForage . Basil.js takes care of abstracting cookie, session, memory, and localstorage storage options, but localforage provides an abstraction for localStorage, WebSQL, or IndexedDB. With modern applications I find that I often want more storage available. Cookie storage is limited at 4Kb, localStorage (5Mb), sessionStorage (same as localStorage)…

Thank you for breaking it down like this. I never saw it layed out ~specifically like this.

Re: Basil.js – Smart persistence layer

#15
post #12

So is this wrapper over cookie and localStorage that takes care of browser differences and idiosyncrasies for you? Or is it more than that?

It also ensure you that your usage of localstorage won't ever throw exceptions and break all your thread in the case of cookie-less anonymized sessions

Re: Basil.js – Smart persistence layer

#17

There's a project with the same name out there: http://basiljs.ch/ This made me wonder: how to deal with similar named open source projects? Although the goals of both projects aren't related in any sense it could cause for some confusion...

Do lots of searching before naming your projects, I suppose. Surely he could have used Rosemary.js, or Herb.js, or Bayleaf.js?

Re: Basil.js – Smart persistence layer

#18
post #8

Earlier quoted context omitted.

Why do you need a mechanism for that instead of using arrays?

Instead of getting an array from storage, pushing a new item inside and then storing it again, it could be nice to have directly this small mechaniam built in to avoid this logic in the application.

Hmm, that's true. The library could monkey patch .push (etc.), but it wouldn't support setting the property directly with [index] (until Object.observe is mainstream enough).
Post reply on HN