32 lines
652 B
JavaScript
32 lines
652 B
JavaScript
|
export default class WidgetBar
|
||
|
{
|
||
|
constructor(id)
|
||
|
{
|
||
|
this.id = id;
|
||
|
this.widgets = [];
|
||
|
}
|
||
|
|
||
|
addWidget(widget)
|
||
|
{
|
||
|
this.widgets.push(widget);
|
||
|
}
|
||
|
|
||
|
getElement()
|
||
|
{
|
||
|
let htmlElement = document.createElement('div');
|
||
|
htmlElement.id = this.id;
|
||
|
|
||
|
this.widgets.forEach(
|
||
|
(widget) => {
|
||
|
let container = document.createElement('div');
|
||
|
|
||
|
container.appendChild(widget.getTitle());
|
||
|
container.appendChild(widget.getElement());
|
||
|
|
||
|
htmlElement.appendChild(container);
|
||
|
}
|
||
|
);
|
||
|
|
||
|
return htmlElement;
|
||
|
}
|
||
|
}
|