Cache tag controller lists for registry
This commit is contained in:
parent
e7a34fa970
commit
341c424941
1 changed files with 8 additions and 1 deletions
|
@ -126,8 +126,15 @@ export class ControllerRegistry {
|
||||||
return this.#defined.get(name)
|
return this.#defined.get(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#listMap = new WeakMap()
|
||||||
list(element) {
|
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) {
|
getName(controller) {
|
||||||
|
|
Loading…
Reference in a new issue