Adds useful debug features to your Electron app
86
Build a simple command-line interface that allows developers to programmatically control Chrome DevTools for Electron applications during development. The tool should provide basic commands to toggle, open, and check the DevTools state for browser windows.
Your application should implement a simple Node.js module that exposes functions to control DevTools behavior:
Toggle DevTools: Implement functionality to toggle DevTools on and off for a browser window. If DevTools are currently closed, they should open. If they're open, they should close.
Open DevTools: Implement functionality to explicitly open DevTools for a browser window, ensuring they are visible.
DevTools State Check: Provide a way to query whether DevTools are currently open for a given window.
The module should handle the case where no specific window is provided by defaulting to the currently focused browser window.
Your implementation must pass the following test cases:
@generates
/**
* Toggle DevTools open/closed state for the specified window or focused window
* @param {BrowserWindow} [window] - The window to toggle DevTools for
*/
function toggleDevTools(window) {}
/**
* Open DevTools for the specified window or focused window
* @param {BrowserWindow} [window] - The window to open DevTools for
*/
function openDevTools(window) {}
/**
* Check if DevTools are currently open for the specified window or focused window
* @param {BrowserWindow} [window] - The window to check DevTools state for
* @returns {boolean} True if DevTools are open, false otherwise
*/
function isDevToolsOpen(window) {}
module.exports = {
toggleDevTools,
openDevTools,
isDevToolsOpen,
};Provides debug features and DevTools management for Electron applications.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-electron-debugdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10