Add chokidar watcher settings.

This commit is contained in:
Patrick Fic
2025-03-12 16:06:22 -07:00
parent a01d4bfb44
commit 10368f8f9e
8 changed files with 195 additions and 10 deletions

View File

@@ -1,13 +1,15 @@
import { ipcMain } from "electron";
import ipcTypes from "../../util/ipcTypes.json";
import log from "electron-log/main";
import { ipcMainHandleAuthStateChanged } from "./ipcMainHandler.user";
import ipcTypes from "../../util/ipcTypes.json";
import { StartWatcher } from "../watcher/watcher";
import {
SettingsWatchedFilePathsGet,
SettingsWatchedFilePathsAdd,
SettingsWatchedFilePathsGet,
SettingsWatchedFilePathsRemove,
} from "./ipcMainHandler.settings";
// Log all IPC messages and their payloads
import { ipcMainHandleAuthStateChanged } from "./ipcMainHandler.user";
// Log all IPC messages and their payloads
const logIpcMessages = () => {
// Get all message types from ipcTypes.toMain
Object.keys(ipcTypes.toMain).forEach((key) => {
@@ -37,8 +39,10 @@ ipcMain.on(ipcTypes.toMain.test, (payload: any) =>
console.log("** Verify that ipcMain is loaded and working.", payload)
);
//Auth handler
ipcMain.on(ipcTypes.toMain.authStateChanged, ipcMainHandleAuthStateChanged);
//Settings Handlers
ipcMain.handle(
ipcTypes.toMain.settings.filepaths.get,
SettingsWatchedFilePathsGet
@@ -47,4 +51,14 @@ ipcMain.handle(
ipcTypes.toMain.settings.filepaths.add,
SettingsWatchedFilePathsAdd
);
ipcMain.handle(
ipcTypes.toMain.settings.filepaths.remove,
SettingsWatchedFilePathsRemove
);
//Watcher Handlers
ipcMain.on(ipcTypes.toMain.watcher.start, () => {
StartWatcher();
});
logIpcMessages();