mirror of
https://github.com/locomotivemtl/locomotive-boilerplate.git
synced 2026-01-15 00:55:08 +08:00
Code style cleanup + Testing event dispatching between modules
This commit is contained in:
@@ -1,23 +1,27 @@
|
||||
// ==========================================================================
|
||||
// Title module
|
||||
// ==========================================================================
|
||||
/* jshint esnext: true */
|
||||
import Module from './Module';
|
||||
|
||||
class Title extends Module {
|
||||
constructor(options) {
|
||||
super();
|
||||
this.$el = options.$el;
|
||||
this.$el = options.$el;
|
||||
this.$label = this.$el.find('.js-label');
|
||||
|
||||
console.log('Title module');
|
||||
console.log(this.$el);
|
||||
this.$document.on('title.changeLabel', (event, value) => {
|
||||
this.changeLabel(value);
|
||||
});
|
||||
}
|
||||
|
||||
changeLabel(value) {
|
||||
this.$label.text(value);
|
||||
}
|
||||
|
||||
// Destroy
|
||||
// ==========================================================================
|
||||
destroy() {
|
||||
this.$document.off('title.changeLabel');
|
||||
this.$el.off();
|
||||
}
|
||||
}
|
||||
|
||||
export default Title;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user