mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
54 lines
1.8 KiB
TypeScript
54 lines
1.8 KiB
TypeScript
import type {
|
|
events as helperEvents,
|
|
handlers as helperHandlers,
|
|
} from '@affine/electron/helper/exposed';
|
|
import type {
|
|
events as mainEvents,
|
|
handlers as mainHandlers,
|
|
} from '@affine/electron/main/exposed';
|
|
import type { AppInfo } from '@affine/electron/preload/electron-api';
|
|
import type { SharedStorage } from '@affine/electron/preload/shared-storage';
|
|
|
|
type MainHandlers = typeof mainHandlers;
|
|
type HelperHandlers = typeof helperHandlers;
|
|
type HelperEvents = typeof helperEvents;
|
|
type MainEvents = typeof mainEvents;
|
|
export type ClientHandler = {
|
|
[namespace in keyof MainHandlers]: {
|
|
[method in keyof MainHandlers[namespace]]: MainHandlers[namespace][method] extends (
|
|
arg0: any,
|
|
...rest: infer A
|
|
) => any
|
|
? (
|
|
...args: A
|
|
) => ReturnType<MainHandlers[namespace][method]> extends Promise<any>
|
|
? ReturnType<MainHandlers[namespace][method]>
|
|
: Promise<ReturnType<MainHandlers[namespace][method]>>
|
|
: never;
|
|
};
|
|
} & HelperHandlers;
|
|
export type ClientEvents = MainEvents & HelperEvents;
|
|
|
|
export const appInfo = (globalThis as any).__appInfo as AppInfo | null;
|
|
export const apis = (globalThis as any).__apis as ClientHandler | undefined;
|
|
export const events = (globalThis as any).__events as ClientEvents | undefined;
|
|
|
|
export const sharedStorage = (globalThis as any).__sharedStorage as
|
|
| SharedStorage
|
|
| undefined;
|
|
|
|
export type { AppInfo, SharedStorage };
|
|
|
|
export {
|
|
type SpellCheckStateSchema,
|
|
type TabViewsMetaSchema,
|
|
type WorkbenchMeta,
|
|
type WorkbenchViewMeta,
|
|
type WorkbenchViewModule,
|
|
} from '@affine/electron/main/shared-state-schema';
|
|
export type { UpdateMeta } from '@affine/electron/main/updater/event';
|
|
export type {
|
|
AddTabOption,
|
|
TabAction,
|
|
} from '@affine/electron/main/windows-manager';
|