# API Reference BetterCurseForge adds a global object, `window.BetterCurseForge`, to CurseForge's Electron renderer process. Themes, plugins and your own scripts can use it to inject styles, patch methods, read and write settings, and listen for events. --- ## TypeScript definitions If you're using TypeScript, this gives you types and autocompletion: ```typescript declare global { interface Window { BetterCurseForge: BetterCurseForgeAPI; } } export interface BetterCurseForgeAPI { /** Active BetterCurseForge runtime version */ readonly version: string; /** Injects CSS dynamically into . Returns an unmount callback. */ injectCSS(css: string): () => void; /** Persistent settings storage */ settings: { get(key?: string): Promise; set(key: string, value: any): Promise; }; /** Runtime method interception and monkey-patching */ patcher: { before(obj: any, method: string, callback: (args: any[]) => void): () => void; after(obj: any, method: string, callback: (args: any[], result: any) => any): () => void; instead(obj: any, method: string, callback: (args: any[], original: Function) => any): () => void; }; /** Event bus */ on(event: string, callback: (...args: any[]) => void): void; off(event: string, callback: (...args: any[]) => void): void; emit(event: string, ...args: any[]): void; /** Internal subsystem managers */ themes: ThemeManager; plugins: PluginManager; ads: AdBlocker; } ``` --- ## Core API ### `BetterCurseForge.version` - **Type**: `string` - **Description**: Version of the BetterCurseForge runtime that's currently running. ```javascript console.log(BetterCurseForge.version); // "1.0.0" ``` --- ### `BetterCurseForge.injectCSS(css)` Adds CSS rules to the document ``. - **Parameters**: - `css` *(string)*: The CSS to inject. - **Returns**: `() => void`. Call it to remove the injected `