va-tracker/types.d.ts

45 lines
1.0 KiB
TypeScript

type Statistics = {
cpuUsage: number;
ramUsage: number;
storageUsage: number;
};
type StaticData = {
totalStorage: number;
cpuModel: string;
totalMemoryGB: number;
};
type View = 'CPU' | 'RAM' | 'STORAGE';
type FrameWindowAction = 'CLOSE' | 'MAXIMIZE' | 'MINIMIZE';
type EventPayloadMapping = {
statistics: Statistics;
getStaticData: StaticData;
changeView: View;
sendFrameAction: FrameWindowAction;
};
type UnsubscribeFunction = () => void;
interface Window {
electron: {
subscribeStatistics: (
callback: (statistics: Statistics) => void
) => UnsubscribeFunction;
getStaticData: () => Promise<StaticData>;
subscribeChangeView: (
callback: (view: View) => void
) => UnsubscribeFunction;
sendFrameAction: (payload: FrameWindowAction) => void;
login: (credentials: { email: string; password: string }) => Promise<any>;
logout: () => Promise<{ success: boolean; error?: string }>;
getToken: (tokenKey: string) => Promise<string | null>;
uploadScreenshot: () => {};
};
}