From 324b290d35f06bb26c4ef5fac893e2a53cdb3b84 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Mon, 7 Aug 2023 16:21:30 -0400 Subject: [PATCH] Move wait periods to const file, increase period of periodic backend updates --- src/consts.ts | 3 +++ src/index.tsx | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/consts.ts b/src/consts.ts index 86a3fd3..4364cb6 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -33,3 +33,6 @@ export const PATH_GEN = "GENERAL_path"; export const MESSAGE_LIST = "MESSAGE_messages"; +export const PERIODICAL_BACKEND_PERIOD = 5000; // milliseconds +export const AUTOMATIC_REAPPLY_WAIT = 2000; // milliseconds + diff --git a/src/index.tsx b/src/index.tsx index 01c98a7..f13a69a 100755 --- a/src/index.tsx +++ b/src/index.tsx @@ -60,6 +60,9 @@ import { PATH_GEN, MESSAGE_LIST, + + PERIODICAL_BACKEND_PERIOD, + AUTOMATIC_REAPPLY_WAIT, } from "./consts"; import { set_value, get_value } from "usdpl-front"; import { Debug } from "./components/debug"; @@ -196,7 +199,7 @@ const reload = function() { //@ts-ignore endHook = SteamClient.Apps.RegisterForGameActionEnd((actionType) => { backend.log(backend.LogLevel.Info, "RegisterForGameActionEnd callback(" + actionType + ")"); - setTimeout(() => backend.forceApplySettings(), 2000 /* ms */); + setTimeout(() => backend.forceApplySettings(), AUTOMATIC_REAPPLY_WAIT); }); backend.log(backend.LogLevel.Debug, "Registered PowerTools callbacks, hello!"); @@ -230,7 +233,7 @@ const Content: VFC<{ serverAPI: ServerAPI }> = ({}) => { periodicHook = setInterval(function() { periodicals(); reloadGUI("periodic" + (new Date()).getTime().toString()); - }, 1000); + }, PERIODICAL_BACKEND_PERIOD); if (!usdplReady || !get_value(LIMITS_INFO)) { // Not translated on purpose (to avoid USDPL issues)