Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (hasLauncherInvoked) {
app.quit();
return;
}
appReady = true;
app.commandLine.appendSwitch('scroll-bounce');
tryCreateWindow();
// if in development install the react devtools extension
if (process.env.NODE_ENV === 'development') {
const {
default: installExtension,
REACT_DEVELOPER_TOOLS,
REDUX_DEVTOOLS,
} = require('electron-devtools-installer');
installExtension(REACT_DEVELOPER_TOOLS.id);
installExtension(REDUX_DEVTOOLS.id);
}
});
});
try {
await installExtension(REACT_DEVELOPER_TOOLS)
} catch (error) {
console.error(error)
}
try {
await installExtension(REDUX_DEVTOOLS)
} catch (error) {
console.error(error)
}
} else {
const path = require('path')
const udata = app.getPath('userData')
const {REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS} = require('electron-devtools-installer')
BrowserWindow.addDevToolsExtension(path.join(udata, 'extensions', REACT_DEVELOPER_TOOLS.id))
BrowserWindow.addDevToolsExtension(path.join(udata, 'extensions', REDUX_DEVTOOLS.id))
}
}
app.on('ready', () => {
installExtension(REDUX_DEVTOOLS.id)
.then((name) => logger.info(`Added Extension: ${name}`))
.catch((err) => logger.error('An error occurred: ', err));
createMainWindow()
backgroundWindow = new BrowserWindow({ show: false })
backgroundWindow.loadFile(require('path').join(__dirname, 'background.html'))
ipc.on('ipfs:state', (event, data) => {
if (mainWindow) mainWindow.webContents.send('ipfs:state', data)
})
ipc.on('ready', (event, data) => {
const sendReady = () => mainWindow.webContents.send('ready', data)
sendReady()
mainWindow.webContents.on('did-finish-load', sendReady)
})