@@ -75,6 +75,23 @@ class NativePHP {
75
75
}
76
76
77
77
private bootstrapApp ( app : Electron . CrossProcessExports . App ) {
78
+ let nativePHPConfig = { } ;
79
+
80
+ // Wait for promise to resolve
81
+ retrieveNativePHPConfig ( ) . then ( ( result ) => {
82
+ try {
83
+ nativePHPConfig = JSON . parse ( result . stdout ) ;
84
+ } catch ( e ) {
85
+ console . error ( e ) ;
86
+ }
87
+ } ) . catch ( ( err ) => {
88
+ console . error ( err ) ;
89
+ } ) . finally ( ( ) => {
90
+ this . setupApp ( nativePHPConfig ) ;
91
+ } ) ;
92
+ }
93
+
94
+ private setupApp ( nativePHPConfig : any ) {
78
95
app . whenReady ( ) . then ( async ( ) => {
79
96
80
97
// Only run this on macOS
@@ -89,17 +106,9 @@ class NativePHP {
89
106
optimizer . watchWindowShortcuts ( window )
90
107
} )
91
108
92
- let nativePHPConfig = { } ;
93
- try {
94
- let { stdout} = await retrieveNativePHPConfig ( )
95
- nativePHPConfig = JSON . parse ( stdout ) ;
96
- } catch ( e ) {
97
- console . error ( e ) ;
98
- }
99
-
100
109
let phpIniSettings = { } ;
101
110
try {
102
- let { stdout} = await retrievePhpIniSettings ( )
111
+ let { stdout } = await retrievePhpIniSettings ( )
103
112
phpIniSettings = JSON . parse ( stdout ) ;
104
113
} catch ( e ) {
105
114
console . error ( e ) ;
@@ -145,15 +154,15 @@ class NativePHP {
145
154
} , 60 * 1000 ) ;
146
155
} , delay ) ;
147
156
148
- app . on ( 'activate' , function ( event , hasVisibleWindows ) {
157
+ app . on ( 'activate' , function ( event , hasVisibleWindows ) {
149
158
// On macOS it's common to re-create a window in the app when the
150
159
// dock icon is clicked and there are no other windows open.
151
160
if ( ! hasVisibleWindows ) {
152
161
notifyLaravel ( 'booted' )
153
162
}
154
163
event . preventDefault ( ) ;
155
164
} )
156
- } )
165
+ } ) ;
157
166
}
158
167
}
159
168
0 commit comments