mirror of
https://github.com/Boof2015/prism.git
synced 2026-08-19 03:54:23 +02:00
astra integration module
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
import type {
|
||||
AstraControlCommand,
|
||||
AstraIntegrationConfig,
|
||||
AstraIntegrationState,
|
||||
} from '../types/astra'
|
||||
import type { CaptureBackendSupport, CaptureBackendSupportEntry } from '../types/capture'
|
||||
import type { NativeCaptureAPI } from '../types/nativeCapture'
|
||||
import type {
|
||||
@@ -48,6 +53,11 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
nativeBackend: resolveNativeCaptureSupport(support.nativeBackend),
|
||||
} satisfies CaptureBackendSupport
|
||||
},
|
||||
getAstraConfig: () => ipcRenderer.invoke('astra:get-config') as Promise<AstraIntegrationConfig>,
|
||||
saveAstraConfig: (config: AstraIntegrationConfig) => ipcRenderer.invoke('astra:save-config', config) as Promise<AstraIntegrationConfig>,
|
||||
getAstraState: () => ipcRenderer.invoke('astra:get-state') as Promise<AstraIntegrationState>,
|
||||
setAstraActive: (active: boolean) => ipcRenderer.invoke('astra:set-active', active) as Promise<AstraIntegrationState>,
|
||||
sendAstraControl: (command: AstraControlCommand) => ipcRenderer.invoke('astra:send-control', command) as Promise<AstraIntegrationState>,
|
||||
getProfileSnapshot: () => ipcRenderer.invoke('profiles:get-snapshot') as Promise<ProfileLibrarySnapshot>,
|
||||
saveNewProfile: (name: string, profile: Profile) => ipcRenderer.invoke('profiles:save-new', name, profile) as Promise<ProfileLibrarySnapshot>,
|
||||
overwriteProfile: (id: string, profile: Profile) => ipcRenderer.invoke('profiles:overwrite', id, profile) as Promise<ProfileLibrarySnapshot>,
|
||||
@@ -107,6 +117,11 @@ contextBridge.exposeInMainWorld('electronAPI', {
|
||||
ipcRenderer.on('window:bounds-changed', handler)
|
||||
return () => ipcRenderer.removeListener('window:bounds-changed', handler)
|
||||
},
|
||||
onAstraStateChanged: (callback: (state: AstraIntegrationState) => void) => {
|
||||
const handler = (_event: Electron.IpcRendererEvent, state: AstraIntegrationState): void => callback(state)
|
||||
ipcRenderer.on('astra:state-changed', handler)
|
||||
return () => ipcRenderer.removeListener('astra:state-changed', handler)
|
||||
},
|
||||
onMainCloseRequested: (callback: () => void) => {
|
||||
const handler = (): void => callback()
|
||||
ipcRenderer.on('window:close-requested', handler)
|
||||
|
||||
Reference in New Issue
Block a user