From b4cdd2dfaa080e51a854928d4512eafab28cd0bd Mon Sep 17 00:00:00 2001 From: DmitryAstafyev Date: Wed, 16 Aug 2023 09:11:21 +0200 Subject: [PATCH] Correct balanced subject --- application/client/src/app/service/ilc/events.ts | 6 +++--- application/platform/env/normalized.ts | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/application/client/src/app/service/ilc/events.ts b/application/client/src/app/service/ilc/events.ts index c156f63b54..9425b53f44 100644 --- a/application/client/src/app/service/ilc/events.ts +++ b/application/client/src/app/service/ilc/events.ts @@ -116,7 +116,7 @@ export class Events { }) => void >(), ), - resize: this._add(new Subject()).balanced(50), + resize: this._add(new Subject()).balanced(25), view: this._add( new Subject(), ), @@ -124,13 +124,13 @@ export class Events { sidebar: { min: this._add(new Subject()), max: this._add(new Subject()), - resize: this._add(new Subject()).balanced(50), + resize: this._add(new Subject()).balanced(25), view: this._add( new Subject(), ), }, window: { - resize: this._add(new Subject().balanced(50)), + resize: this._add(new Subject().balanced(25)), }, layout: { resize: this._add(new Subject()), diff --git a/application/platform/env/normalized.ts b/application/platform/env/normalized.ts index 8d74b4dce1..742d46fac2 100644 --- a/application/platform/env/normalized.ts +++ b/application/platform/env/normalized.ts @@ -15,10 +15,10 @@ export class NormalizedBackgroundTask { const diff = Date.now() - this.timestamp; if (diff > this.duration) { // This task should be done in any way - do not store timer ref - setTimeout(this.safe(task, true), 0); + setTimeout(this.safe(task), 0); } else { // This task could be canceled, store reference - this.timer = setTimeout(this.safe(task, false), this.duration - diff); + this.timer = setTimeout(this.safe(task), this.duration - diff); } } @@ -27,13 +27,13 @@ export class NormalizedBackgroundTask { this.controller.abort(); } - protected safe(task: () => void, untracked: boolean): () => void { + protected safe(task: () => void): () => void { return () => { if (this.controller.signal.aborted) { return; } task(); - this.timestamp = untracked ? 0 : Date.now(); + this.timestamp = Date.now(); }; } }