refactor: extract child-registration boilerplate into WeakMap helpers
Adds registerChildren / unregisterChildren / getChildren to register.ts using module-scoped WeakMaps, removing the duplicated #children / #childHandler fields + lifecycle wiring from 15 components. registerChildren(el, layer) creates the children Map + handler, stores both in WeakMaps, wires the event listener, and calls registerWithParent — all in one call. unregisterChildren(el) tears it down. getChildren(el) gives access to the map for components that need custom child iteration in disconnectedCallback (geojson, layer-group, feature-group). Net: -101 lines, 15 components lose 2-4 fields + 4-8 lifecycle lines each. Components with extra lifecycle work (marker -> dragend, polygon/polyline -> observer + syncCoords) keep their custom additions inline, just the register boilerplate is replaced.main
parent
c18829a0e3
commit
e2752aa7e0
Loading…
Reference in New Issue