mr-crocs-adventures/tilorswift/js/menu/Widget.js

35 lines
709 B
JavaScript
Raw Normal View History

2020-02-04 21:42:14 +01:00
export default class Widget
{
constructor(title)
{
this.title = title;
this.htmlElement = document.createElement('div');
this.isActive = true;
}
getTitle()
{
let htmlElementTitle = document.createElement('div');
htmlElementTitle.classList.add('widget-title');
htmlElementTitle.innerText = this.title;
return htmlElementTitle;
}
enable()
{
this.isActive = true;
this.htmlElement.classList.remove('widget-disabled');
}
disable()
{
this.isActive = false;
this.htmlElement.classList.add('widget-disabled');
}
getElement()
{
return this.htmlElement;
}
}