Added cleanup concept to the template

This commit is contained in:
barsdeveloper
2022-04-14 22:17:38 +02:00
parent 9b0f344dcc
commit d6aa7b22d2
19 changed files with 136 additions and 69 deletions

View File

@@ -3,20 +3,30 @@
/**
* @typedef {import("../element/IElement").default} IElement
*/
/**
* @template {IElement} T
*/
export default class ITemplate {
/**
* @param {IElement} entity
* @param {T} entity
*/
render(entity) {
return ""
}
/**
* @param {IElement} element
* @param {T} element
*/
apply(element) {
setup(element) {
// TODO replace with the safer element.setHTML(...) when it will be availableBreack
element.innerHTML = this.render(element)
}
/**
* @param {T} element
*/
cleanup(element) {
}
}