@@ -8,11 +8,14 @@ import { readConfig, filePath as configFile } from './config';
88
99const store = new Store ( ) ;
1010
11- const executeJavaScript = ( win , script ) => win . webContents . executeJavaScript ( script ) ;
11+ const executeJavaScript = ( win , script ) =>
12+ win . webContents . executeJavaScript ( script ) ;
1213
13- export const checkWindowInfo = win => executeJavaScript ( win , 'window.checkWindowInfo()' ) ;
14+ export const checkWindowInfo = win =>
15+ executeJavaScript ( win , 'window.checkWindowInfo()' ) ;
1416
15- const checkIsOpenInEditorEnabled = win => executeJavaScript ( win , 'window.isOpenInEditorEnabled()' ) ;
17+ const checkIsOpenInEditorEnabled = win =>
18+ executeJavaScript ( win , 'window.isOpenInEditorEnabled()' ) ;
1619
1720const changeMenuItems = menus => {
1821 const rootMenuItems = Menu . getApplicationMenu ( ) . items ;
@@ -21,7 +24,9 @@ const changeMenuItems = menus => {
2124 if ( ! rootMenuItem || ! rootMenuItem . submenu ) return ;
2225
2326 Object . entries ( subMenu ) . forEach ( ( [ subKey , menuSet ] ) => {
24- const menuItem = rootMenuItem . submenu . items . find ( ( { label } ) => label === subKey ) ;
27+ const menuItem = rootMenuItem . submenu . items . find (
28+ ( { label } ) => label === subKey ,
29+ ) ;
2530 if ( ! menuItem ) return ;
2631
2732 Object . assign ( menuItem , menuSet ) ;
@@ -30,16 +35,24 @@ const changeMenuItems = menus => {
3035} ;
3136
3237const invokeDevMethod = ( win , name ) =>
33- executeJavaScript ( win , `window.invokeDevMethod && window.invokeDevMethod('${ name } ')` ) ;
38+ executeJavaScript (
39+ win ,
40+ `window.invokeDevMethod && window.invokeDevMethod('${ name } ')` ,
41+ ) ;
3442
3543const registerKeyboradShortcut = win => {
3644 const prefix = process . platform === 'darwin' ? 'Command' : 'Ctrl' ;
3745 // If another window focused, register a new shortcut
38- if ( globalShortcut . isRegistered ( `${ prefix } +R` ) || globalShortcut . isRegistered ( `${ prefix } +I` ) ) {
46+ if (
47+ globalShortcut . isRegistered ( `${ prefix } +R` ) ||
48+ globalShortcut . isRegistered ( `${ prefix } +I` )
49+ ) {
3950 globalShortcut . unregisterAll ( ) ;
4051 }
4152 globalShortcut . register ( `${ prefix } +R` , ( ) => invokeDevMethod ( win , 'reload' ) ) ;
42- globalShortcut . register ( `${ prefix } +I` , ( ) => invokeDevMethod ( win , 'toggleElementInspector' ) ) ;
53+ globalShortcut . register ( `${ prefix } +I` , ( ) =>
54+ invokeDevMethod ( win , 'toggleElementInspector' ) ,
55+ ) ;
4356} ;
4457
4558const unregisterKeyboradShortcut = ( ) => globalShortcut . unregisterAll ( ) ;
@@ -68,7 +81,7 @@ export const createWindow = ({ iconPath, isPortSettingRequired, port }) => {
6881 `Parse root config failed, please checkout \`${ configFile } \`, the error trace:\n\n` +
6982 `${ error } \n\n` +
7083 'RNDebugger will load default config instead. ' +
71- 'You can click `Debugger` -> `Open Config File` in application menu.'
84+ 'You can click `Debugger` -> `Open Config File` in application menu.' ,
7285 ) ;
7386 }
7487
@@ -83,9 +96,9 @@ export const createWindow = ({ iconPath, isPortSettingRequired, port }) => {
8396 minHeight : minSize ,
8497 ...( increasePosition && winBounds && winBounds . x && winBounds . y
8598 ? {
86- x : winBounds . x + increasePosition ,
87- y : winBounds . y + increasePosition ,
88- }
99+ x : winBounds . x + increasePosition ,
100+ y : winBounds . y + increasePosition ,
101+ }
89102 : { } ) ,
90103 backgroundColor : '#272c37' ,
91104 tabbingIdentifier : 'rndebugger' ,
@@ -127,6 +140,14 @@ export const createWindow = ({ iconPath, isPortSettingRequired, port }) => {
127140 removeUnecessaryTabs ( win ) ;
128141 }
129142 selectRNDebuggerWorkerContext ( win ) ;
143+ setTimeout (
144+ ( ) =>
145+ executeJavaScript (
146+ win ,
147+ 'window.logWelcomeMessage && window.logWelcomeMessage()' ,
148+ ) ,
149+ 1e3 ,
150+ ) ;
130151 } ) ;
131152 win . on ( 'show' , ( ) => {
132153 if ( ! win . isFocused ( ) ) return ;
@@ -141,7 +162,10 @@ export const createWindow = ({ iconPath, isPortSettingRequired, port }) => {
141162 unregisterKeyboradShortcut ( ) ;
142163 store . set ( 'winBounds' , win . getBounds ( ) ) ;
143164 store . set ( 'zoomLevel' , win . webContents . zoomLevel ) ;
144- await executeJavaScript ( win , 'window.beforeWindowClose && window.beforeWindowClose()' ) ;
165+ await executeJavaScript (
166+ win ,
167+ 'window.beforeWindowClose && window.beforeWindowClose()' ,
168+ ) ;
145169 win . destroy ( ) ;
146170 } ;
147171 win . on ( 'close' , event => {
0 commit comments