Created
December 1, 2015 13:37
-
-
Save finom/7610c3f3de120c5c3bd6 to your computer and use it in GitHub Desktop.
Matreshka.js: From simple to simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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