Skip to content

Commit 3ba5c3b

Browse files
committed
Refactor: Delete redundant type definitions
1 parent f749959 commit 3ba5c3b

2 files changed

Lines changed: 4 additions & 28 deletions

File tree

src/preload/index.d.ts

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
import { ElectronAPI } from '@electron-toolkit/preload'
2-
import type { AppState } from '../main/state'
2+
import type { MainAPI } from './index'
33

44
declare global {
55
interface Window {
66
electron: ElectronAPI
7-
api: {
8-
getAppSettings: () => AppSettings
9-
updateAppSettings: (settings: Partial<AppSettings>) => void
10-
updateAppState: (state: Partial<AppState>) => void
11-
onSyncAppSettings: (callback: (settings: AppSettings) => void) => void
12-
removeSyncAppSettingsListener: () => void
13-
onSyncAppState: (callback: (state: AppState) => void) => void
14-
removeSyncAppStateListener: () => void
15-
initShortcuts: (shortcuts: Record<string, { action: string; key: string }>) => Promise<void>
16-
getShortcuts: () => Promise<Record<string, { action: string; status: string }>>
17-
updateShortcuts: (shortcuts: { action: string; key: string }[]) => Promise<void>
18-
onScreenshotTaken: (callback: (screenshotData: string) => void) => void
19-
removeScreenshotListener: () => void
20-
onSolutionChunk: (callback: (chunk: string) => void) => void
21-
removeSolutionChunkListener: () => void
22-
stopSolutionStream: () => Promise<boolean>
23-
onSolutionComplete: (callback: () => void) => void
24-
removeSolutionCompleteListener: () => void
25-
onSolutionStopped: (callback: () => void) => void
26-
removeSolutionStoppedListener: () => void
27-
onSolutionError: (callback: (message: string) => void) => void
28-
removeSolutionErrorListener: () => void
29-
onScrollPageUp: (callback: () => void) => void
30-
removeScrollPageUpListener: () => void
31-
onScrollPageDown: (callback: () => void) => void
32-
removeScrollPageDownListener: () => void
33-
}
7+
api: MainAPI
348
}
359
}

src/preload/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ const api = {
101101
}
102102
}
103103

104+
export type MainAPI = typeof api
105+
104106
// Use `contextBridge` APIs to expose Electron APIs to
105107
// renderer only if context isolation is enabled, otherwise
106108
// just add to the DOM global.

0 commit comments

Comments
 (0)