Backbonejs adapter for IndexedDB

blog.superfeedr.com:/backbonejs-indexeddb

One message a month is clearly not as much as we wanted. There is so much going on right now, but we’re also working on an amazing new product that we an’t wait to get our the door. For this new product, we needed to work on a lot of little things and we decided to open-source them all. Last month, we released an ejabberd module to use Websockets instead of Bosh. Today, we release an IndexedDB adapter for Backbone.js.

For those unfamiliar with IndexedDB, it’s a browser storage engine. You probably know browsers have cookies. Recently (last couple years), they started to include ways to store more data in a more complex form, with stuff like localStorage, or WebSQL. It quickly became obvious to browser manufacturers that the latter was too complex and did not really solve a problem, while the former was too lightweight to provide a scalable infrastructure for rich web apps.

Late in 2009, the W3C started working on a spec for IndexedDB. It takes JSON and the key/value approach of localStorage, as well as indices and advanced queries from WebSQL. The current status is working draft, which means that it will likely change in the future, but that it should also be functional. Many browsers including Chrome, Firefox and Safari support IndexedDB and will likely follow up with that spec.

Backbone.js is a Javascript MVC framework to build elegant applications on the client side. It was initially designed to work with a remote server and its APIs as the data source, but there is nothing that technically prevents it from being used with local storage solutions. For example, Jérôme Gravel-Niquet wrote a LocalStorage adapter.

Unfortunately, localStorage is pretty limited and doesn’t work well for complex data. We hope that IndexedDB quickly grows and fits the needs of many web apps. Please make sure you consult the README file to learn more. Also, feel free to fork it and make it better! Feel free to run the tests with your browser to see if IndexedDB is supported!