My two greatest needs were:
- The ability to utilize the storage mechanism as a cache.
- A greater range of compatibility outside of localStorage support.
To meet these needs, I turned to Lawnchair, a JSON storage library with a wide range of adapters for different storage types, mixed in a little bit of the aforementioned backbone.localstorage plugin, and came out with the beginnings of a (hopefully) useful storage middleware.
While the overall project is in very early stages, its not too soon to look at, play with, and provide feedback on.
- Can be used with or without a backend server
- Configurable cache time to live
- Configure when to use server vs cached model - great for list vs. detail of a record
- Does not require localStorage support, though a Lawnchair adapter may be needed to get the support you want.
- Batch model upload to server (online/offline or time delayed)
- Parameter based caching (for caching paging / search results / etc)
- Remove Require (AMD) dependency
- ??? (accepting ideas)
Also included in the project is a basic 'Todo' style application including a CodeIgniter (php) based RESTful web server and structure, and a Backbone/Require/jQuery front-end consisting of a list/detail view with complete CRUD control and proper routing using both direct (bookmarkable) URL access and pushState routing.
Again, this project is nowhere near complete, so I'm sure there are some bugs... Still on the todo list is to add test cases using Sinon and Jasmine, and there is a known issue with the list -> detail -> list navigation.