18 lines
338 B
TypeScript
18 lines
338 B
TypeScript
export function render(str: string, container?: HTMLElement) {
|
|
if (!container) {
|
|
container ||= document.createElement('div')
|
|
|
|
document.body.appendChild(container)
|
|
}
|
|
|
|
container.innerHTML = str
|
|
|
|
return container
|
|
}
|
|
|
|
export function cleanup() {
|
|
while (document.body.firstChild) {
|
|
document.body.firstChild.remove()
|
|
}
|
|
}
|