INNER CODE UNIT · JavaScript

updateTargetTab

Useful-Scripts-Extension/useful-script · popup/index.js:689

const updateTargetTab = UfsGlobal.Utils.debounce(async () => {
  let targetTab = await getCurrentTab();
  document.title = targetTab?.title || "Useful scripts";
}, 500);

async function initOpenInNewTab() {
  if (!chrome?.tabs) return;

  let currentTab = await chrome.tabs.getCurrent();
  isInNewTab = currentTab != null;

  if (isInNewTab) {
    [
      ["tabs", "onHighlighted"],
      ["windows", "onFocusChanged"],
    ].forEach(([context, event]) => {
      chrome[context][event].addListener(updateTargetTab);
    });

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…