Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

477 B
Raw Blame
import { useSyncExternalStore } from "react";

function subscribe(changed: () => void): () => void {
  const observer = new MutationObserver(changed);
  observer.observe(document.head, { subtree: true, childList: true, characterData: true });
  return () => observer.disconnect();
}

/** The window title as `features/app/title.ts` writes it to `document.title`. */
export function useDocumentTitle(): string {
  return useSyncExternalStore(subscribe, () => document.title);
}