Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented full hierarchical inheritance of any controller event #35

Closed
tristanls opened this issue Jul 29, 2011 · 1 comment
Closed

Comments

@tristanls
Copy link
Collaborator

Because pull request #34 is still pending and I don't want to overwhelm the review process I'm holding off on submitting this feature till #34 is resolved. But you can look at the code on my fork https://github.com/tristanls/agility

This future pull request implements hierarchical inheritance of controller events. It allows us greater reuse of agility objects and enables construction by composition. Here's what that means:

var label = $$( {}, '<span data-bind="label"/>' );

var labeledElement = $$( {}, '<div/>', {
  'create': function() {
    var lbl = $$( label, { label: this.model.get( 'label' ) } );
    this.append( lbl );
  }
});

var labeledValue = $$( labeledElement, {
  controller: {
    'extend:create': function() {  // <- notice the 'extend:' syntax, this is *hint* to the framework to extend instead of overriding
      var value = $$( label, { label: this.model.get( 'value' ) } );
      this.append( value );
    }
  }
});

var myLabeledValue = $$( labeledValue, { label: "myLabel", value: "myValue" } );

<div><span data-bind="label">myLabel</span><span data-bind="label">myValue</span></div>
@tristanls
Copy link
Collaborator Author

Well, I guess these commits got automatically added to the previous pull request. Sorry for the confusion, still working on the finer points of github. This issue is now part of #34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant