File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,7 @@ process.throwDeprecation = true
14
14
var mainWindow = null
15
15
16
16
function initialize ( ) {
17
- var shouldQuit = app . makeSingleInstance ( function ( ) {
18
- if ( mainWindow ) {
19
- if ( mainWindow . isMinimized ( ) ) mainWindow . restore ( )
20
- mainWindow . focus ( )
21
- }
22
- } )
23
-
17
+ var shouldQuit = makeSingleInstance ( )
24
18
if ( shouldQuit ) {
25
19
app . quit ( )
26
20
return
@@ -69,6 +63,22 @@ function initialize () {
69
63
} )
70
64
}
71
65
66
+ // Make this app a single instance app.
67
+ //
68
+ // The main window will be restored and focused instead of a second window
69
+ // opened when a person attempts to launch a second instance.
70
+ //
71
+ // Returns true if the current version of the app should quit instead of
72
+ // launching.
73
+ function makeSingleInstance ( ) {
74
+ return app . makeSingleInstance ( function ( ) {
75
+ if ( mainWindow ) {
76
+ if ( mainWindow . isMinimized ( ) ) mainWindow . restore ( )
77
+ mainWindow . focus ( )
78
+ }
79
+ } )
80
+ }
81
+
72
82
// Handle Squirrel on Windows startup events
73
83
switch ( process . argv [ 1 ] ) {
74
84
case '--squirrel-install' :
You can’t perform that action at this time.
0 commit comments