mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
Move localSettings utility to different file
This commit is contained in:
@@ -1,22 +1,3 @@
|
|||||||
import isElectron from 'is-electron';
|
|
||||||
|
|
||||||
export * from './components/settings';
|
export * from './components/settings';
|
||||||
export * from './hooks/use-default-settings';
|
export * from './hooks/use-default-settings';
|
||||||
|
export * from './utils/local-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,
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user