RenaiApp/types/ipc.d.ts

33 lines
532 B
TypeScript

declare const enum IpcChannel {
LOGIN = 'LOGIN',
LOGGED_IN = 'LOGGED_IN',
}
interface IIpcPayload {
id: string;
data: unknown;
}
interface IIpcResponse {
id: string;
success: boolean;
data?: unknown;
// just the error message
error?: string;
}
interface ICredentials {
name: string;
password: string;
}
interface IIpcClient {
ask: (channel: IpcChannel, data?: unknown) => Promise<unknown>;
}
type IpcHandler = (data?: unknown) => Promise<unknown>;
interface IIpcController {
get(): IIpcController;
}