SproutCore models
http://github.com/sproutit/sproutcore/wikis/sproutcore-s-modern-model-layer
http://github.com/sproutit/sproutcore/wikis/sproutcore-s-modern-model-layer-part-2
http://github.com/sproutit/sproutcore/wikis/sproutcore-s-modern-model-layer-part-3
Those links (if you haven’t checked ’em out) provide some nice insight into how the SproutCore team is thinking about javascript models. It’s an interesting pattern of separation.
Basically:
In a model you use MyModel.get(‘blah’) and MyModel.set(‘blah’) and then (it uses ruby helpers) in a view you do something like this:
[ruby]
< %= progress_view :progress_bar_id,
:minimum => 0,
:maximum => 100,
:indeterminate => true | false,
:value => 50,
:bind => { :value => ‘MyModel.blah’ } %>
[/ruby]
where bind is telling it to update the view everytime the value ‘blah’ changes.
It seems like a relatively simple pattern (at least for simple updates). I’m not totally sold on SproutCore itself (and it’s defacto lock-in to certain UI) but all-in-all those guys are real smart and are paving the way for real client-side javascript frameworks (not just these libraries that we have now).