Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function createMainWindow() {
isDev && await prepareNext('./renderer')
const window = new BrowserWindow()
isDev && window.webContents.openDevTools()
const url = isDev ? 'http://localhost:8000/home' : format({
pathname: path.join(__dirname, '../renderer/home/index.html'),
protocol: 'file',
slashes: true
})
window.loadURL(url)
window.on('closed', () => {
mainWindow = null
})
async function createMainWindow(): Promise {
isDev && await prepareNext('./renderer')
const window: BrowserWindow = new BrowserWindow()
isDev && window.webContents.openDevTools()
const url: string = isDev ? 'http://localhost:8000/home' : format({
pathname: path.join(__dirname, '../renderer/home/index.html'),
protocol: 'file',
slashes: true
})
window.loadURL(url)
window.on('closed', () => {
mainWindow = null
})
module.exports = async function performStart(config) {
const compiler = webpack(config('development'))
let electronStarted = false
await buildRenderer('renderer')
const watching = compiler.watch({}, function(err, stats) {
if (!err && !stats.hasErrors() && !electronStarted) {
electronStarted = true
childProcess
.spawn(electron, ['./app/background.js'], { stdio: 'inherit' })
.on('close', () => {
watching.close()
})
}
})
}
app.on('ready', () => {
const mainWindow = createWindow('main', {
width: 1000,
height: 600
});
mainWindow.loadURL(
format({
pathname: join(__dirname, 'home/index.html'),
protocol: 'file:',
slashes: true
})
);
if (env.name === 'development') {
mainWindow.openDevTools();
}
});