refactoring
This commit is contained in:
15
docs/UIUtils.js
Normal file
15
docs/UIUtils.js
Normal file
@@ -0,0 +1,15 @@
|
||||
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")
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user