Hey I didnt do a great job on those examples, it was a little late and I was hurrying. Heres a better break down:
1. directly calling views
event.m({
template: 'some/template.tmpl',
person: {
name: 'chris thatcher'
},
results: [{
title:'lorem',
link:'
http://pathtoit'
},{
title:'lorem',
link:'
http://pathtoit'
}]
}).
render().//renders default view method 'update'
v('.mymethod').render().//renders default view method 'mymethod'
v('#otherView.update').render().//renders #otherView method 'update'
2. attaching view to multiple dom nodes
$.invert([
{id:'#pagesView', clazz: 'MyApp.Views.Pagination', selector:'.pagination'}
])
recall views are normally associated with a single node with matching id, eg <div id='pages'> in this case we can have several <div class='pages'></div><div class='pages'></div> and they will all be rendered as part of the standard flow.
3. Broadcast
This just using some naming convention patterns to allow calling render() on one view to actually render many views. So assuming I have a MyApp.Views.Foo I can broadcast to the 'MyApp.Views.FooBar' views with this
$.filters([{
id: '#fooViewBroacastFilter',
target: 'MyApp.Views.Foo(.+)',
around: '(update)',
advice: function(invocation){
var model = invocation.arguments[0];
this.update(model);
invocation.proceed();
}
}])
Hopes thats more clear than my first attempt.
--
Christopher Thatcher