Commit ae1abe2 1 parent 439d14c commit ae1abe2 Copy full SHA for ae1abe2
File tree 5 files changed +18
-11
lines changed
5 files changed +18
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { exec } from 'child_process' ;
2
2
import { ipcMain } from 'electron' ;
3
3
import { promisify } from 'util' ;
4
+ import * as events from '../shared/events' ;
4
5
import createLogger from './logger' ;
5
6
6
7
const logger = createLogger ( 'app' ) ;
@@ -27,5 +28,5 @@ async function getRequirements(): Promise<
27
28
export const registerIPCMainHandlers = ( ) : void => {
28
29
logger . info ( 'registerIPCMainHandlers' ) ;
29
30
30
- ipcMain . handle ( 'get-requirements' , getRequirements ) ;
31
+ ipcMain . handle ( events . TIP_GET_REQUIREMENTS , getRequirements ) ;
31
32
} ;
Original file line number Diff line number Diff line change 1
1
import { contextBridge , ipcRenderer } from 'electron' ;
2
+ import { TipManagerAPI } from '../shared/api' ;
3
+ import * as events from '../shared/events' ;
2
4
3
- contextBridge . exposeInMainWorld ( 'electronAPI' , {
4
- getRequirements : ( ) => ipcRenderer . invoke ( 'get-requirements' ) ,
5
- } ) ;
5
+ const tipManagerAPI : TipManagerAPI = {
6
+ getRequirements : ( ) => ipcRenderer . invoke ( events . TIP_GET_REQUIREMENTS ) ,
7
+ } ;
8
+
9
+ contextBridge . exposeInMainWorld ( 'tipmanager' , tipManagerAPI ) ;
Original file line number Diff line number Diff line change
1
+ export interface TipManagerAPI {
2
+ getRequirements ( ) : Promise < { stdout : string ; stderr : string } [ ] > ;
3
+ }
Original file line number Diff line number Diff line change
1
+ export const TIP_GET_REQUIREMENTS = 'TIP_GET_REQUIREMENTS' ;
Original file line number Diff line number Diff line change
1
+ import { TipManagerAPI } from '../../shared/api' ;
2
+
1
3
declare global {
2
4
interface Window {
3
- electronAPI : ElectronAPI ;
5
+ tipmanager : TipManagerAPI ;
4
6
}
5
7
}
6
8
7
- export interface ElectronAPI {
8
- getRequirements : ( ) => Promise < { stdout : string ; stderr : string } [ ] > ;
9
- }
10
-
11
9
export class BaseAPI {
12
- private _base : ElectronAPI ;
10
+ private _base : TipManagerAPI ;
13
11
14
12
get base ( ) {
15
13
return this . _base ;
16
14
}
17
15
18
16
constructor ( ) {
19
- this . _base = window . electronAPI ;
17
+ this . _base = window . tipmanager ;
20
18
}
21
19
}
You can’t perform that action at this time.
0 commit comments