Skip to content

Commit 40fe624

Browse files
committed
Require scripts after ready event fires
1 parent 98596d7 commit 40fe624

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

main-process/menus/application-menu.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,6 @@ if (process.platform === 'win32') {
200200
}
201201

202202
var menu = Menu.buildFromTemplate(template)
203+
console.log('wtf?');
204+
console.log(template);
203205
Menu.setApplicationMenu(menu)

main.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ function initialize () {
1717
var shouldQuit = makeSingleInstance()
1818
if (shouldQuit) return app.quit()
1919

20-
// Require and setup each JS file in the main-process dir
21-
glob(path.join(__dirname, 'main-process/**/*.js'), function (error, files) {
22-
if (error) return console.log(error)
23-
files.forEach(function (file) {
24-
require(file)
25-
})
26-
autoUpdater.updateMenu()
27-
})
28-
2920
function createWindow () {
3021
var windowOptions = {
3122
width: 1080,
@@ -51,6 +42,7 @@ function initialize () {
5142
}
5243

5344
app.on('ready', function () {
45+
loadDemos()
5446
createWindow()
5547
autoUpdater.initialize()
5648
})
@@ -84,6 +76,15 @@ function makeSingleInstance () {
8476
})
8577
}
8678

79+
// Require each JS file in the main-process dir
80+
function loadDemos() {
81+
var files = glob.sync(path.join(__dirname, 'main-process/**/*.js'))
82+
files.forEach(function (file) {
83+
require(file)
84+
})
85+
autoUpdater.updateMenu()
86+
}
87+
8788
// Handle Squirrel on Windows startup events
8889
switch (process.argv[1]) {
8990
case '--squirrel-install':

0 commit comments

Comments
 (0)