mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 18:29:11 +03:00
25 lines
465 B
JavaScript
25 lines
465 B
JavaScript
export class Component {
|
|
constructor(id) {
|
|
this.$el = document.getElementById(id);
|
|
this.$el ? this.setElems() : false;
|
|
this.$el ? this.init() : false;
|
|
}
|
|
|
|
init() {}
|
|
|
|
setElems() {}
|
|
|
|
onShow() {}
|
|
|
|
onHide() {}
|
|
|
|
hide() {
|
|
this.$el ? this.$el.classList.add('hide') : false;
|
|
this.onHide();
|
|
}
|
|
|
|
show() {
|
|
this.$el ? this.$el.classList.remove('hide') : false;
|
|
this.onShow();
|
|
}
|
|
} |