From 91f8cc1399e4a40fa083755caff96b9d716a3a8b Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Mon, 28 Apr 2025 10:30:06 +0200 Subject: [PATCH] ui: move debouncecall --- frontend/app/utils/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/app/utils/index.ts b/frontend/app/utils/index.ts index 0eac9a85a..02caac58e 100644 --- a/frontend/app/utils/index.ts +++ b/frontend/app/utils/index.ts @@ -29,6 +29,16 @@ export function debounce(callback, wait, context = this) { }; } +export function debounceCall(func, wait) { + let timeout; + return function (...args) { + const context = this; + clearTimeout(timeout); + timeout = setTimeout(() => func.apply(context, args), wait); + }; +} + + export function randomInt(a, b) { const min = (b ? a : 0) - 0.5; const max = b || a || Number.MAX_SAFE_INTEGER;