mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-18 06:13:52 +02:00
Fix VRCX.json being slow to save
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import * as workerTimers from 'worker-timers';
|
||||
|
||||
let VRCXStorage = {};
|
||||
|
||||
export default class {
|
||||
@@ -40,12 +38,5 @@ export default class {
|
||||
VRCXStorage.SetObject = function (key, value) {
|
||||
this.Set(key, JSON.stringify(value));
|
||||
};
|
||||
|
||||
workerTimers.setInterval(
|
||||
() => {
|
||||
VRCXStorage.Flush();
|
||||
},
|
||||
5 * 60 * 1000
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
|
||||
'VRCX_ProxyServer',
|
||||
vrcxStore.proxyServer
|
||||
);
|
||||
await VRCXStorage.Flush();
|
||||
await VRCXStorage.Save();
|
||||
await new Promise((resolve) => {
|
||||
workerTimers.setTimeout(resolve, 100);
|
||||
});
|
||||
@@ -263,7 +263,7 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
|
||||
'VRCX_ProxyServer',
|
||||
vrcxStore.proxyServer
|
||||
);
|
||||
await VRCXStorage.Flush();
|
||||
await VRCXStorage.Save();
|
||||
await new Promise((resolve) => {
|
||||
workerTimers.setTimeout(resolve, 100);
|
||||
});
|
||||
|
||||
@@ -90,7 +90,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
});
|
||||
|
||||
window.electron.onWindowStateChange((event, newState) => {
|
||||
state.windowState = newState.windowState;
|
||||
state.windowState = newState.toString();
|
||||
debounce(saveVRCXWindowOption, 300)();
|
||||
});
|
||||
|
||||
@@ -364,7 +364,6 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
VRCXStorage.Set('VRCX_SizeWidth', state.sizeWidth.toString());
|
||||
VRCXStorage.Set('VRCX_SizeHeight', state.sizeHeight.toString());
|
||||
VRCXStorage.Set('VRCX_WindowState', state.windowState);
|
||||
VRCXStorage.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user