Rindle

API index and search · Build metadata

Supporting declarations

packages/devtools/src/global.ts. These declarations explain referenced types. Only package-page symbols are package exports.

Exact source

DevtoolsHub

/** The discovery surface a panel binds to: the set of attached cores + a change subscription. */
export interface DevtoolsHub {
    readonly version: number;
    readonly cores: readonly DevtoolsCore[];
    /** Fires whenever a core attaches or detaches (so a panel can pick one up). */
    subscribe(listener: () => void): () => void;
    /** Register a core; returns its deregistration function. */
    register(core: DevtoolsCore): () => void;
}

getDevtoolsHub

/** Get (creating on first use) the global devtools hub. A panel calls this to discover attached
 *  clients; it is safe to call before any `attachDevtools`. */
export declare function getDevtoolsHub(): DevtoolsHub;

getDevtoolsCore

/** The most recently attached core, or `undefined` — the common single-app convenience a panel uses. */
export declare function getDevtoolsCore(): DevtoolsCore | undefined;

attachDevtools

/** Attach a devtools pane to a running client (DEBUG-TOOLS-BROWSER-DESIGN §6.2). Call this ONLY in a
 *  dev build (e.g. behind `import.meta.env.DEV` with a dynamic `import("@rindle/devtools")`) so the
 *  pane, its core, and this registration tree-shake out of production. Returns the {@link DevtoolsCore}
 *  (also discoverable via {@link getDevtoolsHub}); call `core.detach()` to unwind. */
export declare function attachDevtools(target: DevtoolsTarget, opts?: DevtoolsCoreOptions): DevtoolsCore;