mirror of
https://github.com/sergeyyarkov/digital-store.git
synced 2026-10-11 10:19:15 +03:00
22 lines
544 B
JavaScript
22 lines
544 B
JavaScript
import { Component } from "../core/component";
|
|
|
|
export class InformationComponent extends Component {
|
|
constructor(id) {
|
|
super(id);
|
|
}
|
|
|
|
init() {
|
|
if (this.$el) {
|
|
if (!localStorage.getItem('visited')) {
|
|
this.show();
|
|
}
|
|
const btn = this.$el.querySelector('#information-close');
|
|
btn.addEventListener('click', buttonHandler.bind(this));
|
|
}
|
|
}
|
|
}
|
|
|
|
function buttonHandler() {
|
|
localStorage.setItem('visited', JSON.stringify(true));
|
|
this.hide();
|
|
} |