initLogTab function exported

Last updated: 2026-03-01T23:25:47.138Z

Metrics

LOC: 28 Complexity: 4 Params: 0

Signature

initLogTab(): : void

Source Code

export function initLogTab(): void {
  // Inject log viewer styles once
  const style = document.createElement("style");
  style.textContent = getLogViewerStyles("options");
  document.head.appendChild(style);

  // Observe when the log tab becomes visible to init the viewer
  const tabContent = document.getElementById("tab-log");
  if (!tabContent) return;

  const observer = new MutationObserver(() => {
    if (tabContent.classList.contains("active")) {
      setupViewer();
      observer.disconnect();
    }
  });

  observer.observe(tabContent, {
    attributes: true,
    attributeFilter: ["class"],
  });

  // Also check if already active (e.g. deep link)
  if (tabContent.classList.contains("active")) {
    setupViewer();
    observer.disconnect();
  }
}

Dependencies (Outgoing)

graph LR initLogTab["initLogTab"] LogViewer["LogViewer"] createLogViewer["createLogViewer"] getLogViewerStyles["getLogViewerStyles"] setupViewer["setupViewer"] initLogTab -->|uses| LogViewer initLogTab -->|uses| createLogViewer initLogTab -->|uses| getLogViewerStyles initLogTab -->|calls| setupViewer style initLogTab fill:#dbeafe,stroke:#2563eb,stroke-width:2px click initLogTab "f0e7324e99722ddb.html" click LogViewer "2c892361993c78a3.html" click createLogViewer "cc8b77ecd2282660.html" click getLogViewerStyles "50064436258d3937.html" click setupViewer "b9fbe5505eaeb3e4.html"
TargetType
LogViewer uses
createLogViewer uses
getLogViewerStyles uses
setupViewer calls

Impact (Incoming)

graph LR initLogTab["initLogTab"] main["main"] main -->|calls| initLogTab style initLogTab fill:#dbeafe,stroke:#2563eb,stroke-width:2px click initLogTab "f0e7324e99722ddb.html" click main "14348c66c1e5604a.html"
SourceType
main calls