import { useOpenAiGlobal } from "moonpeak/chatgpt";
useOpenAiGlobal<T>(key: string): T | undefinedRead a window.openai global (for example maxHeight, locale, userAgent) and re-render when ChatGPT changes it. undefined outside ChatGPT.
Example
const maxHeight = useOpenAiGlobal<number>("maxHeight");Works in
ChatGPT. Safe to call anywhere: elsewhere it returns an empty value or does nothing.
See all hooks in Runtime APIs.