Created
February 4, 2014 13:44
-
-
Save biodigitals/8803795 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // static/modules/application/my_component.js | |
| App.MyComponentView = Backbone.View.extend({ | |
| // component wrapping your features | |
| el: "#mycomponent", | |
| events:{ | |
| 'click #mybutton':'myMethod' | |
| }, | |
| prepare:function(){ | |
| // init code for component | |
| }, | |
| update: function(){ | |
| // update component view here | |
| }, | |
| myMethod:function(e){ | |
| // what happens when user clicks my button ? | |
| } | |
| }); | |
| // and at the end of the page ... | |
| <script> | |
| App.myComponentView = new App.MyComponentView(); | |
| </script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment