Created
March 16, 2015 09:38
-
-
Save rukeba/d3e10ae239cd7a13167c to your computer and use it in GitHub Desktop.
Example Component
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
jQuery(function ($) { | |
window.ExampleComponent = { | |
$placeholder: $('.js-component-placeholder'), | |
$item: $('.js-component-item'), | |
$btn_submit: $('.js-btn-component-submit'), | |
init: function () { | |
this.load_something(); | |
this.bind_events(); | |
}, | |
bind_events: function (){ | |
this.$item.click( function( e ){ | |
ExampleComponent.process_item(); | |
}); | |
this.$btn_submit.click( function( e ) { | |
ExampleComponent.save_component(); | |
}); | |
}, | |
load_something: function () { | |
// load | |
}, | |
process_item: function () { | |
// process | |
}, | |
save_component: function () { | |
// post | |
} | |
}; | |
ExampleComponent.init(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment