devtools-detect
Version:
Detect if DevTools is open and its orientation
35 lines (29 loc) • 687 B
TypeScript
declare global {
interface Window {
addEventListener(
type: 'devtoolschange',
listener: (event: DevToolsEvent) => unknown,
options?: boolean | AddEventListenerOptions
): void;
removeEventListener(
type: 'devtoolschange',
listener: (event: DevToolsEvent) => unknown,
options?: boolean | EventListenerOptions
): void;
}
}
export type Orientation = 'vertical' | 'horizontal';
export interface DevToolsEvent extends Event {
detail: typeof devTools;
}
declare const devTools: {
/**
Whether DevTools is open.
*/
readonly isOpen: boolean;
/**
Orientation of the DevTools if it's open.
*/
readonly orientation?: Orientation;
};
export default devTools;