Skip to content

Comment on New Rails-like Framework from 37signals for HTML5 Mobile Apps

Comments

For anyone interested in the idea of having multiple views in JavaScript (with their own URLs!), "Sammy" is a client-side JavaScript framework that's like Ruby's Sinatra: http://code.quirkey.com/sammy/

Indeed, what Ryan mentions sounds a bit like the ideas of Sammy, Backbone, and HTML5 local storage and offline caching blended together into a single tasty package.

If you'd like to browse an example Todos application (with annotated source code) that fuses Backbone.js and HTML5 local storage, here's a good place to start:

http://documentcloud.github.com/backbone/examples/todos/inde...

The particular Backbone/LocalStorage integration works quite well for this little app, despite being simplistic:

http://documentcloud.github.com/backbone/docs/backbone-local...

Edit: There seem to be a lot of folks who think that Sammy is the only way to get client-side routing -- nothing could be further from the truth. Sammy asks you to structure your entire app around an inappropriate faux-server-side API, and Sammy apps don't work correctly in Internet Explorer because Sammy doesn't use an iframe to set history in IE. Doing hashchange events yourself only takes about a page of code, and handling hash URLs is a relatively tiny portion of a client-side app:

https://gist.github.com/624773

That said, so many folks have asked for hashchange routing that perhaps it would be wise to build a Backbone plugin for it that smooths over the difference between pushState and hashchange...

Completely agree, and I'd definitely recommend an integrated history management component.

Yes, I think a Backbone plugin that provided that would be very well received.

+1 one for Sammy. I find Backbone too complex, but I like how Sammy doesn't impose almost anything.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.