MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / toggle

Method toggle

src/components/fileTree/index.js:172–205  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170 $content._fileTree = null;
171
172 const toggle = async () => {
173 const isExpanded = !$wrapper.classList.contains("hidden");
174
175 if (isExpanded) {
176 // Collapse
177 $wrapper.classList.add("hidden");
178
179 if (childTree) {
180 childTree.destroy();
181 this.childTrees.delete(url);
182 childTree = null;
183 $content._fileTree = null;
184 }
185 this.options.onExpandedChange?.(url, false);
186 } else {
187 // Expand
188 $wrapper.classList.remove("hidden");
189 $title.classList.add("loading");
190
191 // Create child tree with incremented depth
192 childTree = new FileTree($content, {
193 ...this.options,
194 _depth: this.depth + 1,
195 });
196 this.childTrees.set(url, childTree);
197 $content._fileTree = childTree;
198 try {
199 await childTree.load(url);
200 } finally {
201 $title.classList.remove("loading");
202 }
203 this.options.onExpandedChange?.(url, true);
204 }
205 };
206
207 $title.addEventListener("click", (e) => {
208 e.stopPropagation();

Callers 12

main.jsFile · 0.80
settingsPage.jsFile · 0.80
index.jsFile · 0.80
editorFile.jsFile · 0.80
"toggle-fullscreen"Function · 0.80
"toggle-sidebar"Function · 0.80
"toggle-inspector"Function · 0.80
getBodyFunction · 0.80
activeMethod · 0.80
toggleReplaceFunction · 0.80
toggleExtrasFunction · 0.80
colorFunction · 0.80

Calls 6

addMethod · 0.80
setMethod · 0.80
deleteMethod · 0.65
destroyMethod · 0.45
removeMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected