1- const { contextBridge } = require ( 'electron' )
1+ const { contextBridge } = require ( 'electron' ) ;
22
3- const opts = parseArgs ( window . process . argv )
4- const socketId = opts . get ( '--socketId' )
3+ const opts = parseArgs ( window . process . argv ) ;
4+ const socketId = opts . get ( '--socketId' ) ;
55
6- const ipc = require ( 'node-ipc' )
7- ipc . config . silent = true
8- ipc . config . appspace = opts . get ( '--socketAppspace' )
6+ const ipc = require ( 'node-ipc' ) ;
7+ ipc . config . silent = true ;
8+ ipc . config . appspace = opts . get ( '--socketAppspace' ) ;
99
10- contextBridge . exposeInMainWorld (
11- 'myapp' ,
12- {
13- uuid : require ( 'uuid' ) ,
14- isDev : opts . get ( '--isDev' ) ,
15- appVersion : opts . get ( '--appVersion' ) ,
16- socketId,
17- ipcOn,
18- ipcEmit
19- }
20- )
10+ contextBridge . exposeInMainWorld ( 'myapp' , {
11+ uuid : require ( 'uuid' ) ,
12+ isDev : opts . get ( '--isDev' ) ,
13+ appVersion : opts . get ( '--appVersion' ) ,
14+ socketId,
15+ ipcOn,
16+ ipcEmit,
17+ } ) ;
2118function ipcOn ( id , handle ) {
2219 ipc . connectTo ( id , ( ) => {
23- ipc . of [ id ] . on ( " message" , handle . message )
24- ipc . of [ id ] . on ( " connect" , handle . connect )
25- ipc . of [ id ] . on ( " disconnect" , handle . disconnect )
26- } )
20+ ipc . of [ id ] . on ( ' message' , handle . message ) ;
21+ ipc . of [ id ] . on ( ' connect' , handle . connect ) ;
22+ ipc . of [ id ] . on ( ' disconnect' , handle . disconnect ) ;
23+ } ) ;
2724}
2825
2926function ipcEmit ( id , ...args ) {
30- return ipc . of [ id ] . emit ( ...args )
27+ return ipc . of [ id ] . emit ( ...args ) ;
3128}
3229
3330function parseArgs ( argv ) {
3431 return argv . reduce ( ( args , arg ) => {
35- const match = arg . split ( "=" )
36- args . set ( match [ 0 ] , match [ 1 ] || true )
37- return args
38- } , new Map ( ) )
39- }
32+ const match = arg . split ( '=' ) ;
33+ args . set ( match [ 0 ] , match [ 1 ] || true ) ;
34+ return args ;
35+ } , new Map ( ) ) ;
36+ }
0 commit comments