Skip to content

Instantly share code, notes, and snippets.

@finom
Created December 1, 2015 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finom/7610c3f3de120c5c3bd6 to your computer and use it in GitHub Desktop.
Save finom/7610c3f3de120c5c3bd6 to your computer and use it in GitHub Desktop.
Matreshka.js: From simple to simple
var Application = Class({
'extends': Matreshka,
constructor: function() {
// bind x property to the text field
this.bindNode( 'x', '.my-input' );
// bind x property and block to my-output class
this.bindNode( 'x', '.my-output', {
setValue: function( v ) {
this.innerHTML = v;
}
});
// if х property has been changed, display it in the console
this.on( 'change:x', function() {
console.log( 'x has been changed to' + this.x );
});
}
});
var app = new Application();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment