Just started to experiment with HTML5 features and really like the localStorage.
And now I wonder if it makes sense to create some libraries which make life easier. Something which easily persists objects from the localStorage to the server-DB. Something like a object.findAllByAttribute(Attribute) etc.
So my question is: is there already something out there which helps me to write offline html5 applications? If not, would it make sense or am I thinking the wrong way?
Rails uses a technique called "Unobtrusive JavaScript" to handle attaching JavaScript to the DOM. This is generally considered to be a best-practice within the frontend community, but you may occasionally read tutorials that demonstrate other ways. When clicked, the link background will become red.
This bit of JS should be put in the file app/assets/javascripts/blogs. js. coffee (CoffeeScript is the default way to create JS for Rails).
Javascript is a client-side coding language that excels at front-end application development. On the other hand, Ruby on Rails is a full-stack framework that is most often used for backend development. It's obvious from this description that they don't compete, but rather complement each other.
backbone.js is a Javascript framework which will help make that task easier. It has support for localStorage as well as sync from server.
http://documentcloud.github.com/backbone/
This is an example application which make use of localStorage.
http://documentcloud.github.com/backbone/docs/todos.html
This uses backbone localStorage adapter.
http://documentcloud.github.com/backbone/docs/backbone-localstorage.html
I haven't used it myself but https://github.com/wycats/jquery-offline might be quite a good fit.
Also there is js-model which supports localStorage https://github.com/benpickles/js-model, I have used it and it is very good, I think syncing between localStorage and your server is probably fairly app specific though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With