Skip to content

Instantly share code, notes, and snippets.

@rukeba
Created March 16, 2015 09:38
Show Gist options
  • Save rukeba/d3e10ae239cd7a13167c to your computer and use it in GitHub Desktop.
Save rukeba/d3e10ae239cd7a13167c to your computer and use it in GitHub Desktop.
Example Component
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