Skip to content

Instantly share code, notes, and snippets.

@s6577t
Created June 18, 2012 10:26
Show Gist options
  • Select an option

  • Save s6577t/2947779 to your computer and use it in GitHub Desktop.

Select an option

Save s6577t/2947779 to your computer and use it in GitHub Desktop.
Views, service-location, declarative dsl
// Setup
var app
View.handlerFor = function(view){
new Handler(app, view.models)
}
View
.domEvent('form', 'click', 'submitted', function(e){ return e.clientX; })
.modelEvents([
'video', 'something:change', 'updateSoemthing'])
.instance({
updateSoemthing
...
})
view = {
handler: function(){
return this._handler if this._handler
this._handler = this.constructor.handlerFor(this)
return this._handler
}
}
handler = {
submitted: function(e){
this.app.server.save(this.models.item)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment