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

32 lines
652 B
JavaScript
Raw Normal View History

2020-02-04 21:42:14 +01:00
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;
}
}