Cache tag controller lists for registry

This commit is contained in:
Talia 2025-08-09 19:32:44 +02:00
parent e7a34fa970
commit 341c424941
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -126,8 +126,15 @@ export class ControllerRegistry {
return this.#defined.get(name)
}
#listMap = new WeakMap()
list(element) {
return new ControllerList(element, this.#attribute)
if (this.#listMap.has(element)) {
return this.#listMap.get(element)
} else {
const list = new ControllerList(element, this.#attribute)
this.#listMap.set(element, list)
return list
}
}
getName(controller) {