Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'electron-debug' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
mainWindow.webContents.on("did-finish-load", () => {
if (mainWindow) {
mainWindow.maximize()
mainWindow.show()
mainWindow.focus()
}
})
mainWindow.on("closed", () => {
mainWindow = undefined
})
if (inDevelopment) {
const electronDebug = require("electron-debug")
electronDebug()
electronDebug.openDevTools(mainWindow)
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
mainWindow.webContents.on("context-menu", (e: any, props: any) => {
const { x, y } = props
Menu.buildFromTemplate([{
label: "Inspect element",
click() {
if (mainWindow) {
mainWindow.webContents.inspectElement(x, y)
}
},
}]).popup(props)
})
}
if (inDarwin) {
export function installExtensions(): Promise {
// TODO: Check use
if (process.env.NODE_ENV === 'development') {
const p = path.join(__dirname, '..', 'app', 'node_modules');
// tslint:disable-next-line:no-var-requires
require('module').globalPaths.push(p);
}
// Install electron debug
// https://github.com/sindresorhus/electron-debug
electronDebug({
showDevTools: true,
devToolsMode: 'previous',
});
// Install sourceMap support
sourceMapSupport.install();
log.debug("[STARTUP] Installed source map support");
// Install react dev tools and redux devtools
const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
const react = installExtension(REACT_DEVELOPER_TOOLS, forceDownload)
.then((name) => log.debug(`[STARTUP] ${name} installed`))
.catch((err) => {
log.error(err);
log.error('[STARTUP] Failed to install React Dev Tools');
throw err;
create(config = {}) {
this._currentWindow = new BrowserWindow({
...windowCurrentSetting,
...config,
})
this.instences.push(this._currentWindow)
if (config.url) {
this.loadURL(config.url)
}
if (process.env.NODE_ENV === 'development') {
if (config.devtool) {
require('electron-debug').openDevTools(this._currentWindow)
}
}
return this._currentWindow
}
click: () => {
electronDebug.devTools(win);
},
accelerator: 'F12'
click: () => electronDebug.refresh(win),
accelerator: 'F5'