main
John Lauer Keep Codex turns running across editor reloads; fix hidden-tab startup and composer fade in the optional package 4307d94 1mo ago
'use strict';

// Installed only by the optional adom/codex wiki package.
// VS Code does not instantiate a restored hidden webview until it is shown.
exports.watchRenderer = function (webview, role, provider, guard, onDispose) {
  const panel = role === 'panel' ? provider.findPanelByWebview(webview) : null;
  if (!panel) { guard.start(); return; }
  const update = () => {
    if (panel.visible) guard.start();
    else if (guard.timeout != null) {
      clearTimeout(guard.timeout);
      guard.timeout = undefined;
    }
  };
  const changed = panel.onDidChangeViewState(update);
  let disposed;
  disposed = onDispose(() => { changed.dispose(); disposed?.dispose(); guard.dispose(); });
  update();
};