MCPcopy Create free account
hub / github.com/UNLINEARITY/Obsidian-CodeSpace / disposeCodeEmbed

Function disposeCodeEmbed

src/code_embed.ts:348–371  ·  view source on GitHub ↗
(embedEl: HTMLElement)

Source from the content-addressed store, hash-verified

346}
347
348function disposeCodeEmbed(embedEl: HTMLElement) {
349 const ownerWindow = embedEl.ownerDocument.defaultView ?? window;
350 const pendingTimer = pendingEmbedTimers.get(embedEl);
351 if (pendingTimer) {
352 ownerWindow.clearTimeout(pendingTimer);
353 pendingEmbedTimers.delete(embedEl);
354 }
355 pendingEmbedRequests.delete(embedEl);
356 embedRenderTokens.delete(embedEl);
357
358 const child = embedChildren.get(embedEl);
359 if (child) {
360 child.onunload();
361 embedChildren.delete(embedEl);
362 }
363
364 const staticChild = embedStaticChildren.get(embedEl);
365 if (staticChild) {
366 staticChild.onunload();
367 embedStaticChildren.delete(embedEl);
368 }
369
370 embedEl.removeAttribute("data-code-space-rendered-for");
371}
372
373function queueAllCodeEmbedsInDocument(doc: Document, docWindow: Window, plugin: CodeSpacePlugin) {
374 doc.querySelectorAll(".file-embed").forEach((element) => {

Callers 3

renderCodeEmbedFunction · 0.85

Calls 1

onunloadMethod · 0.45

Tested by

no test coverage detected