RenaiApp/src/types/ipc.ts

32 lines
544 B
TypeScript
Raw Normal View History

2019-06-19 00:15:16 +02:00
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;
}