Move localSettings utility to different file

This commit is contained in:
jeffvli
2022-11-13 02:08:02 -08:00
parent c469e2e5cc
commit ab7787484c
2 changed files with 21 additions and 20 deletions
+1 -20
View File
@@ -1,22 +1,3 @@
import isElectron from 'is-electron';
export * from './components/settings';
export * from './hooks/use-default-settings';
const ipc = isElectron() ? window.electron.ipcRenderer : null;
const get = (property: string) => ipc?.SETTINGS_GET({ property });
const set = (property: string, value: any) => {
ipc?.SETTINGS_SET({ property, value });
};
const restart = () => {
ipc?.APP_RESTART();
};
export const localSettings = {
get,
restart,
set,
};
export * from './utils/local-settings';
@@ -0,0 +1,20 @@
import isElectron from 'is-electron';
const ipc = isElectron() ? window.electron.ipcRenderer : null;
export const getLocalSetting = (property: string) =>
ipc?.SETTINGS_GET({ property });
export const setLocalSetting = (property: string, value: any) => {
ipc?.SETTINGS_SET({ property, value });
};
export const restartApp = () => {
ipc?.APP_RESTART();
};
export const localSettings = {
get: getLocalSetting,
restart: restartApp,
set: setLocalSetting,
};