TelegramPWA/src/types/electron.ts
Alexander Zinchuk 3cd9192c1d Electron: Load application from URL (#3774)
Electron: safe fallback for missed background image in cache (#3883)
2023-09-25 14:41:13 +02:00

44 lines
1.5 KiB
TypeScript

export enum ElectronEvent {
FULLSCREEN_CHANGE = 'fullscreen-change',
UPDATE_ERROR = 'update-error',
UPDATE_AVAILABLE = 'update-available',
DEEPLINK = 'deeplink',
}
export enum ElectronAction {
GET_IS_FULLSCREEN = 'get-is-fullscreen',
INSTALL_UPDATE = 'install-update',
HANDLE_DOUBLE_CLICK = 'handle-double-click',
OPEN_NEW_WINDOW = 'open-new-window',
SET_WINDOW_TITLE = 'set-window-title',
SET_TRAFFIC_LIGHT_POSITION = 'set-traffic-light-position',
SET_IS_AUTO_UPDATE_ENABLED = 'set-is-auto-update-enabled',
GET_IS_AUTO_UPDATE_ENABLED = 'get-is-auto-update-enabled',
SET_IS_TRAY_ICON_ENABLED = 'set-is-tray-icon-enabled',
GET_IS_TRAY_ICON_ENABLED = 'get-is-tray-icon-enabled',
RESTORE_LOCAL_STORAGE = 'restore-local-storage',
}
export type TrafficLightPosition = 'standard' | 'lowered';
export interface ElectronApi {
isFullscreen: () => Promise<boolean>;
installUpdate: () => Promise<void>;
handleDoubleClick: () => Promise<void>;
openNewWindow: (url: string, title?: string) => Promise<void>;
setWindowTitle: (title?: string) => Promise<void>;
setTrafficLightPosition: (position: TrafficLightPosition) => Promise<void>;
setIsAutoUpdateEnabled: (value: boolean) => Promise<void>;
getIsAutoUpdateEnabled: () => Promise<boolean>;
setIsTrayIconEnabled: (value: boolean) => Promise<void>;
getIsTrayIconEnabled: () => Promise<boolean>;
restoreLocalStorage: () => Promise<void>;
on: (eventName: ElectronEvent, callback: any) => VoidFunction;
}
declare global {
interface Window {
electron?: ElectronApi;
}
}