43 lines
955 B
TypeScript
43 lines
955 B
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>;
|
|
getToken: (tokenKey: string) => Promise<string | null>;
|
|
};
|
|
}
|
|
|
|
|
|
|