35 lines
709 B
JavaScript
35 lines
709 B
JavaScript
|
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;
|
||
|
}
|
||
|
}
|