mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-28 17:18:46 +00:00
Not-so-magic performance improvement
This commit is contained in:
@@ -40,13 +40,10 @@ export class View implements Mounter{
|
|||||||
}
|
}
|
||||||
|
|
||||||
mounted(el: Element, clear = true): void {
|
mounted(el: Element, clear = true): void {
|
||||||
for (const id in this.registry) {
|
el.querySelectorAll('[data-id]').forEach(el => {
|
||||||
const element = el.querySelector(`[data-id="${id}"]`)
|
const id = el.getAttribute('data-id')!
|
||||||
if (element !== null) {
|
this.registry[id]?.(el)
|
||||||
this.registry[id](element)
|
})
|
||||||
delete this.registry[id]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (clear) {
|
if (clear) {
|
||||||
this.registry = {}
|
this.registry = {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user