bindHandlers function application

Last updated: 2026-03-04T23:36:57.288Z

Metrics

LOC: 42 Complexity: 5 Params: 0

Signature

bindHandlers(): : void

Source Code

function bindHandlers(): void {
  const btnFillAll = document.getElementById(
    "btn-fill-all",
  ) as HTMLButtonElement | null;
  btnFillAll?.addEventListener("click", async () => {
    const orig = btnFillAll.textContent ?? "";
    btnFillAll.textContent = "…";
    await doSend({ type: "FILL_ALL_FIELDS" }, btnFillAll, orig);
  });

  const btnFillAi = document.getElementById(
    "btn-fill-ai",
  ) as HTMLButtonElement | null;
  btnFillAi?.addEventListener("click", async () => {
    const context = await openAIContextModal();
    if (context === null) return;
    const orig = btnFillAi.textContent ?? "";
    btnFillAi.textContent = "…";
    await doSend(
      { type: "FILL_CONTEXTUAL_AI", payload: context },
      btnFillAi,
      orig,
    );
  });

  const btnFillEmpty = document.getElementById(
    "btn-fill-empty",
  ) as HTMLButtonElement | null;
  btnFillEmpty?.addEventListener("click", async () => {
    const orig = btnFillEmpty.textContent ?? "";
    btnFillEmpty.textContent = "…";
    await doSend(
      { type: "FILL_ALL_FIELDS", payload: { fillEmptyOnly: true } },
      btnFillEmpty,
      orig,
    );
  });

  document.getElementById("btn-settings")?.addEventListener("click", () => {
    chrome.runtime.openOptionsPage();
  });
}

Dependencies (Outgoing)

graph LR bindHandlers["bindHandlers"] doSend["doSend"] openAIContextModal["openAIContextModal"] bindHandlers -->|calls| doSend bindHandlers -->|calls| openAIContextModal style bindHandlers fill:#dbeafe,stroke:#2563eb,stroke-width:2px click bindHandlers "e0addfeca217a6b2.html" click doSend "a64fadbf3863fefa.html" click openAIContextModal "97760a8ce5debd4a.html"
TargetType
doSend calls
openAIContextModal calls
click dynamic_call

Impact (Incoming)

graph LR bindHandlers["bindHandlers"] init["init"] init -->|calls| bindHandlers style bindHandlers fill:#dbeafe,stroke:#2563eb,stroke-width:2px click bindHandlers "e0addfeca217a6b2.html" click init "9c03e8cd6a18eb5d.html"
SourceType
init calls