Javascript on Rails
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开发者_如何学Python-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?
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.
Here is another javascript library for handling localStorage: https://github.com/polvero/Kizzy
I have not used it, but it looks worthy of consideration.
just found http://www.javascriptmvc.com/ . Looks interesting, simpler than backbone.js and closer to Rails or Grails.
But have to admit that the focus is not the offline feature. But I guess when you already have a model, offline isn't the big problem anymore.
things advanced and it seems that http://angularjs.org/ is what I was looking for at the time I asked the question.
There is also a great talk about using AngularJs together with Grails for creating SPI Applications: http://skillsmatter.com/podcast/home/developing-spi-applications-using-grails-and-angularjs
精彩评论