11const { app, BrowserWindow} = require ( 'electron' ) ;
2- const path = require ( 'path' )
3- const url = require ( 'url' )
4-
5- // Keep a global reference of the window object, if you don't, the window will
6- // be closed automatically when the JavaScript object is garbage collected.
7- let mainWindow
8-
9- function createWindow ( ) {
10- // Create the browser window.
11- mainWindow = new BrowserWindow ( {
12- titleBarStyle : 'hidden' ,
13- resizable : true ,
14- frame : false ,
15- minWidth : 720 ,
16- maxWidth : 720 ,
17- width : 720 ,
18- height : 930 ,
19- webPreferences : {
20- devTools : true
21- } ,
22- icon : path . join ( __dirname , '/assets/img/logo_normal.png' )
23- } )
24-
25- // and load the index.html of the app.
26- mainWindow . loadURL ( url . format ( {
27- pathname : path . join ( __dirname , 'index.html' ) ,
28- protocol : 'file:' ,
29- slashes : true
30- } ) )
31-
32- // Open the DevTools.
33- // mainWindow.webContents.openDevTools()
34-
35- // Emitted when the window is closed.
36- mainWindow . on ( 'closed' , function ( ) {
37- // Dereference the window object, usually you would store windows
38- // in an array if your app supports multi windows, this is the time
39- // when you should delete the corresponding element.
40- mainWindow = null
41- } )
42- }
43-
44- // This method will be called when Electron has finished
45- // initialization and is ready to create browser windows.
46- // Some APIs can only be used after this event occurs.
47- app . on ( 'ready' , createWindow )
48-
49- // Quit when all windows are closed.
50- app . on ( 'window-all-closed' , ( ) => {
51- // On macOS it is common for applications and their menu bar
52- // to stay active until the user quits explicitly with Cmd + Q
53- if ( process . platform !== 'darwin' ) {
54- app . quit ( )
55- }
2+ const { FileWatcher} = require ( './filewatcher' ) ;
3+ const path = require ( 'path' )
4+ const url = require ( 'url' )
5+
6+ // Keep a global reference of the window object, if you don't, the window will
7+ // be closed automatically when the JavaScript object is garbage collected.
8+ let mainWindow
9+
10+ function createWindow ( ) {
11+ // Create the browser window.
12+ mainWindow = new BrowserWindow ( {
13+ titleBarStyle : 'hidden' ,
14+ resizable : true ,
15+ frame : false ,
16+ minWidth : 720 ,
17+ maxWidth : 720 ,
18+ width : 720 ,
19+ height : 930 ,
20+ webPreferences : {
21+ devTools : true
22+ } ,
23+ icon : path . join ( __dirname , '/assets/img/logo_normal.png' )
5624 } )
57-
58- app . on ( 'activate' , ( ) => {
59- // On macOS it's common to re-create a window in the app when the
60- // dock icon is clicked and there are no other windows open.
61- if ( wimainWindown === null ) {
62- createWindow ( )
63- }
25+
26+ // and load the index.html of the app.
27+ mainWindow . loadURL ( url . format ( {
28+ pathname : path . join ( __dirname , 'index.html' ) ,
29+ protocol : 'file:' ,
30+ slashes : true
31+ } ) )
32+
33+ // Open the DevTools.
34+ // mainWindow.webContents.openDevTools()
35+
36+ // Emitted when the window is closed.
37+ mainWindow . on ( 'closed' , function ( ) {
38+ // Dereference the window object, usually you would store windows
39+ // in an array if your app supports multi windows, this is the time
40+ // when you should delete the corresponding element.
41+ mainWindow = null
6442 } )
65-
66- // In this file you can include the rest of your app's specific main process
67- // code. You can also put them in separate files and require them here.
43+
44+ if ( fileWatcher != null ) {
45+ fileWatcher . shutdown ( ) ;
46+ }
47+ }
48+
49+ // This method will be called when Electron has finished
50+ // initialization and is ready to create browser windows.
51+ // Some APIs can only be used after this event occurs.
52+ app . on ( 'ready' , createWindow )
53+
54+ // Quit when all windows are closed.
55+ app . on ( 'window-all-closed' , ( ) => {
56+ // On macOS it is common for applications and their menu bar
57+ // to stay active until the user quits explicitly with Cmd + Q
58+ if ( process . platform !== 'darwin' ) {
59+ app . quit ( )
60+ }
61+ } )
62+
63+ app . on ( 'activate' , ( ) => {
64+ // On macOS it's common to re-create a window in the app when the
65+ // dock icon is clicked and there are no other windows open.
66+ if ( mainWindow === null ) {
67+ createWindow ( )
68+ }
69+ } )
70+
71+ // In this file you can include the rest of your app's specific main process
72+ // code. You can also put them in separate files and require them here.
0 commit comments