RenaiApp/types/ipc.d.ts

32 lines
552 B
TypeScript

declare const enum IpcChannels {
ERROR = 'ERROR',
LOGIN = 'LOGIN',
LOGGED_IN = 'LOGGED_IN',
}
interface IIpcPayload {
id: string;
data: any;
}
interface IIpcResponse {
id: string;
success: boolean;
data?: any;
error?: any;
}
interface ICredentials {
name: string;
password: string;
}
interface IIpcClient {
ask: (channel: IpcChannels, data?: any) => Promise<any>;
}
interface IIpcServer {
answer: (channel: IpcChannels, handler: (data?: any) => Promise<any>) => void;
send: (channel: IpcChannels, data: any) => void;
}