36 lines
728 B
TypeScript
36 lines
728 B
TypeScript
|
|
"use strict";
|
|
|
|
import {IpcHandler} from "@/composables/useIpcMain";
|
|
import accountHandlers from "./account";
|
|
import useSessionListeners from "./session";
|
|
// import useAudioListeners from "./audio";
|
|
|
|
interface IPCHandlers {
|
|
[channel: string]: IpcHandler<any, any>;
|
|
}
|
|
|
|
const ipcHandlers: IPCHandlers = {};
|
|
|
|
const _initHandlers = (handlers: Array<IpcHandler<any, any>>) => {
|
|
handlers.forEach((h: IpcHandler<any, any>) => {
|
|
if (!(h.channel in ipcHandlers)) {
|
|
ipcHandlers[h.channel] = h;
|
|
h.handle();
|
|
}
|
|
});
|
|
}
|
|
|
|
export default function useIpc(): void {
|
|
|
|
_initHandlers(accountHandlers);
|
|
|
|
// useAccountListeners();
|
|
|
|
useSessionListeners();
|
|
|
|
// useAudioListeners();
|
|
|
|
}
|
|
|
|
|