mime-chat/src/types.ts
Andrew Gundersen a791f973dc working protocols
2021-06-29 11:30:35 -05:00

88 lines
1.4 KiB
TypeScript

interface Update {
name: string;
data: Message[] | Message | Annotation | string;
}
interface Message {
modifier: string;
content: string[];
context: boolean | string;
uid: string;
}
interface Annotation {
name: string;
data: string | string[];
uid: string;
}
interface Raw {
text: string | boolean;
audio: string | boolean;
}
interface WindowState {
width: number;
height: number;
x: number | null;
y: number | null;
}
interface Profile {
crimataId: string;
alias: string;
initials: string;
}
interface LoginPayload {
email: string;
password: string;
}
interface AuthState {
profile: Profile | null;
token: string | null;
}
interface AccountCredentials {
email: string;
password: string;
}
/*
* Electron Ipc
*/
interface IpcHandlerCallback<I, O> {
(payload: I | null): Promise<Error | O>;
}
interface IpcListenerCallback<T> {
(payload: T): void;
}
interface IIpcHandler<I, O> {
handle(): void;
remove(): void;
readonly _handlerCallback: IpcHandlerCallback<I, O>;
}
interface IIpcListener<I> {
listen(): void;
remove(): void;
readonly _listenerCallback: IpcListenerCallback<I>;
}
interface IPCHandlers {
[handler: string]: IIpcHandler<any, any>;
}
interface IPCListeners {
[listener: string]: IIpcListener<any> | null;
}
interface IpcRendererEvent<T> {
channel: string;
payload: T | null;
}