saveWatcherSettings function

Last updated: 2026-03-03T18:32:34.140Z

Metrics

LOC: 31 Complexity: 2 Params: 0

Signature

saveWatcherSettings(): : Promise<void>

Source Code

async function saveWatcherSettings(): Promise<void> {
  const settings: Partial<Settings> = {
    watcherEnabled: (
      document.getElementById("setting-watcher-enabled") as HTMLInputElement
    ).checked,
    watcherAutoRefill: (
      document.getElementById("setting-watcher-auto-refill") as HTMLInputElement
    ).checked,
    watcherShadowDOM: (
      document.getElementById("setting-watcher-shadow-dom") as HTMLInputElement
    ).checked,
    watcherDebounceMs: Math.min(
      5000,
      Math.max(
        100,
        Number(
          (
            document.getElementById(
              "setting-watcher-debounce",
            ) as HTMLInputElement
          ).value,
        ) || 600,
      ),
    ),
  };
  await chrome.runtime.sendMessage({
    type: "SAVE_SETTINGS",
    payload: settings,
  });
  showToast(t("savedAuto"));
}

No outgoing dependencies.

Impact (Incoming)

graph LR saveWatcherSettings["saveWatcherSettings"] bindSettingsEvents["bindSettingsEvents"] bindSettingsEvents -->|calls| saveWatcherSettings style saveWatcherSettings fill:#dbeafe,stroke:#2563eb,stroke-width:2px click saveWatcherSettings "2ae10f14691640a6.html" click bindSettingsEvents "29719c6741ea9340.html"
SourceType
bindSettingsEvents calls