Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mainWindow.webContents.once("dom-ready", () => {
// In development install extensions
if (process.env.MH_ENV === "development") {
console.log("Development mode. Adding dev-tools.");
const Installer = require("electron-devtools-installer");
Promise.all([
Installer.default(Installer.REACT_DEVELOPER_TOOLS),
Installer.default(Installer.REDUX_DEVTOOLS)
]).catch(err => {
console.log(`DevTools: ${err}`);
});
}
});
}
mainWindow = new electron_1.BrowserWindow({
webPreferences: {
contextIsolation: false,
nodeIntegration: true,
webviewTag: true,
},
height: 600,
width: 960,
titleBarStyle: 'hiddenInset',
vibrancy: 'dark',
});
// and load the index.html of the app.
// mainWindow.loadFile('index.html')
var isDev = require('electron-is-dev');
if (isDev) {
var _a = require('electron-devtools-installer'), installExtension = _a.default, REACT_DEVELOPER_TOOLS = _a.REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS = _a.REDUX_DEVTOOLS;
installExtension(REACT_DEVELOPER_TOOLS)
.then(function (name) {
return console.info("Added Extension: " + name);
})
.catch(function (err) {
return console.error('An error occurred: ', err);
});
installExtension(REDUX_DEVTOOLS)
.then(function (name) {
return console.info("Added Extension: " + name);
})
.catch(function (err) {
return console.error('An error occurred: ', err);
});
// require('devtron').install()
mainWindow.loadURL('http://localhost:3000/?react_perf');
const { BrowserWindow, app } = require('electron')
const installExtension = require('electron-devtools-installer')
const extensionList = [
installExtension.REACT_DEVELOPER_TOOLS,
installExtension.REDUX_DEVTOOLS
]
let mainWindow
let loadingWindow
let loadUrl = process.env.NODE_ENV === 'development'
? 'http://localhost:3000/'
: `file://${__dirname}/build/index.html`
function createMainWindows () {
mainWindow = new BrowserWindow({
height: 670,
useContentSize: true,
width: 1020,
// autoHideMenuBar: true,
titleBarStyle: 'hiddenInset',
show: false,
{
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
},
}
)
mainWindow.loadFile(`./app/index.html`)
installExtension.default(installExtension.REACT_DEVELOPER_TOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
installExtension.default(installExtension.REDUX_DEVTOOLS)
.then((name) => console.log(`Added Extension: ${name}`))
.catch((err) => console.log('An error occurred: ', err));
mainWindow.webContents.openDevTools()
})
function installDevExtensions() {
const installExtension = require('electron-devtools-installer').default
const REACT_DEVELOPER_TOOLS = require('electron-devtools-installer').REACT_DEVELOPER_TOOLS
const REDUX_DEVTOOLS = require('electron-devtools-installer').REDUX_DEVTOOLS
console.log(chalk.blue(`Installing DevTools extensions...`));
console.log()
return new Promise((resolve, reject) => {
installExtension(REACT_DEVELOPER_TOOLS)
.then((name) => {
console.log(`${chalk.green(`✓`)} ${name}`)
console.log()
resolve()
})
.catch((err) => {
console.log(chalk.red(`An error occurred: ${err}`))
console.log()
reject()
})
id: edi.JQUERY_DEBUGGER,
longName: 'jQuery Debugger'
},
angular: {
installer: 'edi',
id: edi.ANGULARJS_BATARANG,
longName: 'AngularJS Batarang'
},
vuejs: {
installer: 'edi',
id: edi.VUEJS_DEVTOOLS,
longName: 'Vue.js devtools'
},
redux: {
installer: 'edi',
id: edi.REDUX_DEVTOOLS,
longName: 'Redux DevTools'
},
reactPerf: {
installer: 'edi',
id: edi.REACT_PERF,
longName: 'React Perf'
},
devtron: {
installer: 'devtron',
longName: 'devtron'
}
}
exports.tools = tools
const longNames = {}