File tree Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Expand file tree Collapse file tree 1 file changed +10
-11
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ function createWindow () {
2121 } ) ;
2222}
2323
24- app . on ( 'ready' , createWindow ) ;
24+ app . on ( 'ready' , ( ) => {
25+ createWindow ( ) ;
26+ const menu = Menu . buildFromTemplate ( getTemplate ( ) ) ;
27+ Menu . setApplicationMenu ( menu ) ;
28+ } ) ;
2529app . on ( 'window-all-closed' , function ( ) {
2630 if ( process . platform !== 'darwin' ) {
2731 app . quit ( ) ;
@@ -33,11 +37,8 @@ app.on('activate', function () {
3337 }
3438} ) ;
3539
36- app . once ( 'ready' , function ( ) {
37- if ( Menu . getApplicationMenu ( ) )
38- return ;
39-
40- var template = [
40+ function getTemplate ( ) {
41+ const template = [
4142 {
4243 label : 'Edit' ,
4344 submenu : [
@@ -168,7 +169,7 @@ app.once('ready', function() {
168169 ]
169170 } ,
170171 ] ;
171- var pjson = require ( './package.json' ) ;
172+ const pjson = require ( './package.json' ) ;
172173
173174 if ( process . platform == 'darwin' ) {
174175 template . unshift ( {
@@ -236,7 +237,5 @@ var pjson = require('./package.json');
236237 }
237238 ) ;
238239 }
239-
240- var menu = Menu . buildFromTemplate ( template ) ;
241- Menu . setApplicationMenu ( menu ) ;
242- } ) ;
240+ return template ;
241+ }
You can’t perform that action at this time.
0 commit comments