@fto-consult/expo-ui 7.4.40 → 7.4.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/electron/index.js +17 -7
- package/package.json +1 -1
package/electron/index.js
CHANGED
@@ -132,6 +132,13 @@ function createBrowserWindow (options){
|
|
132
132
|
_win.on('closed', function() {
|
133
133
|
_win = null;
|
134
134
|
});
|
135
|
+
if(options.registerDevToolsCommand !== false){
|
136
|
+
globalShortcut.register('CommandOrControl+F12', () => {
|
137
|
+
if(_win && _win instanceof BrowserWindow){
|
138
|
+
toggleDevTools(undefined,_win);
|
139
|
+
}
|
140
|
+
});
|
141
|
+
}
|
135
142
|
return _win;
|
136
143
|
}
|
137
144
|
function createWindow () {
|
@@ -139,6 +146,7 @@ function createWindow () {
|
|
139
146
|
win = createBrowserWindow({
|
140
147
|
showOnLoad : false,
|
141
148
|
loadURL : undefined,
|
149
|
+
registerDevToolsCommand : false,
|
142
150
|
preload : path.resolve(__dirname,'preload.js'),
|
143
151
|
webPreferences : {
|
144
152
|
devTools : true,
|
@@ -265,6 +273,7 @@ function createWindow () {
|
|
265
273
|
if(mainProcess && typeof mainProcess =='object' && typeof mainProcess.onCreateWindow =='function'){
|
266
274
|
mainProcess.onCreateWindow(win);
|
267
275
|
}
|
276
|
+
return win;
|
268
277
|
}
|
269
278
|
|
270
279
|
const quit = ()=>{
|
@@ -283,17 +292,18 @@ app.on('window-all-closed', () => {
|
|
283
292
|
}
|
284
293
|
})
|
285
294
|
|
286
|
-
const toggleDevTools = (value)=>{
|
287
|
-
|
288
|
-
|
295
|
+
const toggleDevTools = (value,window)=>{
|
296
|
+
window = window instanceof BrowserWindow ? window : win;
|
297
|
+
if(window !==null && window.webContents){
|
298
|
+
const isOpen= window.webContents.isDevToolsOpened();
|
289
299
|
value = value === undefined ? !isOpen : value;
|
290
300
|
if(value && !isOpen){
|
291
|
-
|
292
|
-
return
|
301
|
+
window.webContents.openDevTools();
|
302
|
+
return window.webContents.isDevToolsOpened();
|
293
303
|
} else {
|
294
|
-
if(isOpen)
|
304
|
+
if(isOpen) window.webContents.closeDevTools();
|
295
305
|
}
|
296
|
-
return
|
306
|
+
return window.webContents.isDevToolsOpened();
|
297
307
|
}
|
298
308
|
return false;
|
299
309
|
}
|