refactor: webui config

This commit is contained in:
手瓜一十雪
2024-05-20 16:56:34 +08:00
parent 03b08ac8d1
commit e3d0c38216
3 changed files with 37 additions and 22 deletions

View File

@@ -35,10 +35,13 @@ setTimeout(() => {
}, 0);
class HTTPHeart{
class HTTPHeart {
intervalId: NodeJS.Timeout | null = null;
start(){
const { heartInterval, } = ob11Config;
start(NewHeartInterval: number | undefined = undefined) {
let { heartInterval } = ob11Config;
if (NewHeartInterval && !Number.isNaN(NewHeartInterval)) {
heartInterval = NewHeartInterval;
}
if (this.intervalId) {
clearInterval(this.intervalId);
}
@@ -48,8 +51,8 @@ class HTTPHeart{
}, heartInterval);
}
stop(){
if (this.intervalId){
stop() {
if (this.intervalId) {
clearInterval(this.intervalId);
}
}