@@ -8,38 +8,30 @@ const isMacOS = process.platform === 'darwin';
88
99const devToolsOptions = { } ;
1010
11- function toggleDevTools ( win ) {
12- win = win || BrowserWindow . getFocusedWindow ( ) ;
13-
11+ function toggleDevTools ( win = BrowserWindow . getFocusedWindow ( ) ) {
1412 if ( win ) {
15- const contents = win . webContents ;
16- if ( contents . isDevToolsOpened ( ) ) {
17- contents . closeDevTools ( ) ;
13+ const { webContents } = win ;
14+ if ( webContents . isDevToolsOpened ( ) ) {
15+ webContents . closeDevTools ( ) ;
1816 } else {
19- contents . openDevTools ( devToolsOptions ) ;
17+ webContents . openDevTools ( devToolsOptions ) ;
2018 }
2119 }
2220}
2321
24- function devTools ( win ) {
25- win = win || BrowserWindow . getFocusedWindow ( ) ;
26-
22+ function devTools ( win = BrowserWindow . getFocusedWindow ( ) ) {
2723 if ( win ) {
2824 toggleDevTools ( win ) ;
2925 }
3026}
3127
32- function openDevTools ( win ) {
33- win = win || BrowserWindow . getFocusedWindow ( ) ;
34-
28+ function openDevTools ( win = BrowserWindow . getFocusedWindow ( ) ) {
3529 if ( win ) {
3630 win . webContents . openDevTools ( devToolsOptions ) ;
3731 }
3832}
3933
40- function refresh ( win ) {
41- win = win || BrowserWindow . getFocusedWindow ( ) ;
42-
34+ function refresh ( win = BrowserWindow . getFocusedWindow ( ) ) {
4335 if ( win ) {
4436 win . webContents . reloadIgnoringCache ( ) ;
4537 }
@@ -71,7 +63,7 @@ const addExtensionIfInstalled = (name, getPath) => {
7163 if ( ! isExtensionInstalled ( name ) ) {
7264 BrowserWindow . addDevToolsExtension ( getPath ( name ) ) ;
7365 }
74- } catch ( err ) { }
66+ } catch ( _ ) { }
7567} ;
7668
7769module . exports = opts => {
0 commit comments