MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / registerComponent

Function registerComponent

packages/debugger/src/structure/walker.ts:81–112  ·  view source on GitHub ↗
(
    r:        ComponentRegistry<TEl>,
    owner:    Solid.Component,
    id:       NodeID,
    name:     string | undefined,
    elements: TEl[] | null,
)

Source from the content-addressed store, hash-verified

79
80export
81const registerComponent = <TEl extends object>(
82 r: ComponentRegistry<TEl>,
83 owner: Solid.Component,
84 id: NodeID,
85 name: string | undefined,
86 elements: TEl[] | null,
87): void => {
88 // Handle cleanup if elements is null
89 if (elements == null) {
90 cleanupComponent(r, id)
91 return
92 }
93
94 let set = new Set(elements)
95
96 let existing = r.components.get(id)
97 if (existing != null) {
98 existing.elements = set
99 return
100 }
101
102 let cleanup = onOwnerCleanup(owner, () => cleanupComponent(r, id), false, $CLEANUP)
103
104 r.components.set(id, {
105 id: id,
106 owner: owner,
107 name: name,
108 elements: set,
109 element_nodes: new Set(),
110 cleanup: cleanup,
111 })
112}
113
114export
115const registerElement = <TEl extends object>(

Callers 1

mapOwnerFunction · 0.85

Calls 3

onOwnerCleanupFunction · 0.90
cleanupComponentFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…