Files
HowBadIsMyBatch/docs/UIUtils.js
frankknoll dd4d521918 refactoring
2022-03-15 09:04:57 +01:00

20 lines
643 B
JavaScript

class UIUtils {
static instantiateTemplate(templateId) {
return document.getElementById(templateId).content.firstElementChild.cloneNode(true);
}
static createChartViewElementWithHeading(heading) {
const chartViewElement = UIUtils.instantiateTemplate('template-ChartView');
chartViewElement.querySelector(".heading").textContent = heading;
return {
chartViewElement: chartViewElement,
canvas: chartViewElement.querySelector(".canvas")
};
}
static getSelectedOption(selectElement) {
return selectElement.options[selectElement.selectedIndex];
}
}