auto-git:

[add] src/desktop/
This commit is contained in:
2026-05-06 04:38:34 +02:00
parent 01b0763478
commit 4773f01a76

25
src/desktop/desktopApi.js Normal file
View File

@@ -0,0 +1,25 @@
const getElectronApi = () => window.electronAPI
function callElectronApi(methodName, ...args) {
const method = getElectronApi()?.[methodName]
if (typeof method !== 'function') {
return undefined
}
return method(...args)
}
const desktopApi = {
getSettings: () => callElectronApi('getSettings'),
getUpdateStatus: () => callElectronApi('getUpdateStatus'),
checkForUpdates: () => callElectronApi('checkForUpdates'),
getChangelogPage: (page) => callElectronApi('getChangelogPage', page),
setSetting: (key, value) => callElectronApi('setSetting', key, value),
updateSettings: (settings) => callElectronApi('updateSettings', settings),
pickPaths: (options) => callElectronApi('pickPaths', options),
openPath: (filePath) => callElectronApi('openPath', filePath),
openExternalLink: (event) => callElectronApi('openExternalLink', event),
onWindowFocus: (callback) => callElectronApi('onWindowFocus', callback),
offWindowFocus: (callback) => callElectronApi('offWindowFocus', callback),
}
export default desktopApi