-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added flag to disable/enable dev tool
- Loading branch information
Showing
1 changed file
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,45 @@ | ||
const {app, BrowserWindow} = require("electron"); | ||
const {app, BrowserWindow, Menu} = require("electron"); | ||
const path = require("path"); | ||
|
||
//flag for production or dev environment | ||
process.env.NODE_ENV = "development"; | ||
|
||
//create menu with chrome devtool | ||
var mainMenuTemplate = [ | ||
{ | ||
label: 'Developer Tools', | ||
click(item, focusedWindow) { | ||
focusedWindow.toggleDevTools(); | ||
} | ||
|
||
} | ||
]; | ||
|
||
|
||
|
||
function createWindow() { | ||
|
||
var mainWindow = new BrowserWindow(); | ||
|
||
//add dev tool option to menu | ||
const mainMenu = Menu.buildFromTemplate(mainMenuTemplate); | ||
Menu.setApplicationMenu(mainMenu); | ||
|
||
|
||
mainWindow.loadFile(path.join(__dirname, "mainWindow.html")); | ||
if(process.env.NODE_ENV === "production") | ||
mainWindow.removeMenu(); | ||
|
||
//Quit app when closed | ||
mainWindow.on("closed", function() { | ||
app.quit(); | ||
}) | ||
|
||
|
||
|
||
} | ||
|
||
app.on("ready", function() { | ||
createWindow(); | ||
}) | ||
}) | ||
|