argon-cli
Version:
Argon CLI provide tools for creating components and running build scripts
32 lines (29 loc) • 626 B
Plain Text
import $ from 'jquery';
class #component# {
constructor({ el }) {
this.root = $(el);
}
cache = {};
initCache() {
/* Initialize selector cache here */
/**
* Use "this.root" to find elements within current component
* Example:
* this.cache.$submitBtn = this.root.find('.js-submit-btn');
*/
}
bindEvents() {
/* Bind jQuery events here */
/**
* Example:
* const { $submitBtn } = this.cache;
* $submitBtn.on('click', () => { ... });
*/
}
init() {
/* Mandatory method */
this.initCache();
this.bindEvents();
}
}
export default #component#;