Skip to content

Commit

Permalink
♻️ Put api interface into the renderer file
Browse files Browse the repository at this point in the history
  • Loading branch information
Schneegans committed Jun 16, 2023
1 parent 486b40c commit ce86af5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 32 deletions.
4 changes: 2 additions & 2 deletions src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ contextBridge.exposeInMainWorld('api', {
showDevTools: function () {
ipcRenderer.send('show-dev-tools');
},
simulateShortcut: function () {
ipcRenderer.send('simulate-shortcut');
simulateKeys: function () {
ipcRenderer.send('simulate-keys');
},
movePointer: function (dist: { x: number; y: number }) {
ipcRenderer.send('move-pointer', dist);
Expand Down
27 changes: 0 additions & 27 deletions src/renderer.d.ts

This file was deleted.

18 changes: 18 additions & 0 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ import './index.scss';

import { Menu } from './menu/menu';

interface IElectronAPI {
loadPreferences: () => void;
hideWindow: (delay: number) => void;
showDevTools: () => void;
simulateKeys: () => void;
movePointer: (dist: { x: number; y: number }) => void;
openURI: (uri: string) => void;
itemSelected: () => void;
log: (message: string) => void;
showMenu: (func: (pos: { x: number; y: number }) => void) => void;
}

declare global {
interface Window {
api: IElectronAPI;
}
}

const container = document.getElementById('menu-container');
const menu = new Menu(container);

Expand Down
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
]
}
},
"files": [
"src/renderer.d.ts"
],
"include": [
"src/**/**/*"
]
Expand Down

0 comments on commit ce86af5

Please sign in to comment.