Initial commit

This commit is contained in:
2025-06-26 11:28:55 +08:00
commit e11c59cdc2
167 changed files with 6029 additions and 0 deletions

27
src/preload/index.js Normal file
View File

@@ -0,0 +1,27 @@
import { contextBridge , ipcRenderer} from 'electron'
import { electronAPI } from '@electron-toolkit/preload'
// Custom APIs for renderer
const api = {}
// Use `contextBridge` APIs to expose Electron APIs to
// renderer only if context isolation is enabled, otherwise
// just add to the DOM global.
if (process.contextIsolated) {
try {
contextBridge.exposeInMainWorld('electron', electronAPI)
contextBridge.exposeInMainWorld('api', api)
ipcRenderer.on('data-from-main', (event, key,value) => {
localStorage.setItem(key, value);
});
} catch (error) {
console.error(error)
}
} else {
window.electron = electronAPI
window.api = api
}