RenaiApp/src/types/ipc.ts

32 lines
544 B
TypeScript

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;
}