Track bundled vendor runtime sources
Some checks failed
CI / main (push) Has been cancelled
CI / release-e2e (push) Has been cancelled

This commit is contained in:
2026-07-07 10:05:50 +08:00
parent fbe179ab53
commit 52636c91ae
2111 changed files with 1850012 additions and 14 deletions

40
vendor/aigcpanel/electron/mapi/env.ts vendored Normal file
View File

@@ -0,0 +1,40 @@
import electron, { BrowserWindow } from "electron";
import { Log } from "./log";
export const AppEnv = {
isInit: false,
appRoot: null as string,
appData: null as string,
userData: null as string,
dataRoot: null as string,
};
export const AppRuntime = {
fileHubRoot: null as string,
splashWindow: null as BrowserWindow,
mainWindow: null as BrowserWindow,
windows: {} as Record<string, BrowserWindow>,
};
export const waitAppEnvReady = async () => {
while (!AppEnv.isInit) {
await new Promise((resolve) => {
setTimeout(resolve, 1000);
});
}
};
export const callHandleFromMainOrRender = async (name: string, ...args) => {
if (electron.ipcRenderer) {
return electron.ipcRenderer.invoke(name, ...args);
} else {
// @ts-ignore
const func = electron.ipcMain._invokeHandlers.get(name);
if (func) {
return func(...args);
} else {
Log.error(`No handler found for ${name}`);
return null;
}
}
};