From 57a30d696f0fd8690ccc254e6302dfdba7027cfc Mon Sep 17 00:00:00 2001 From: Lajos Meszaros Date: Thu, 16 May 2024 20:28:22 +0200 Subject: [PATCH] docs(useDelay): add info about delay's and uniqueDelay's times being stacked --- src/scripting/hooks/useDelay.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/scripting/hooks/useDelay.ts b/src/scripting/hooks/useDelay.ts index 7acaa1f3..e7fd810d 100644 --- a/src/scripting/hooks/useDelay.ts +++ b/src/scripting/hooks/useDelay.ts @@ -45,6 +45,11 @@ export const useDelay = () => { /** * creates a timer with a unique identifier (TIMERdelay16) * can be cancelled + * + * delay calls are stacked on top of previous values of delay() and uniqueDelay() calls: + * + * delay(100) ... -> executed 100 milliseconds after script start + * delay(200) ... -> executed (100 + 200) milliseconds after script start */ const delay = (delayInMs: number = 0) => { delayOffset += Math.floor(delayInMs) @@ -55,6 +60,11 @@ export const useDelay = () => { * creates a timer without any identifier (TIMER) * so the delay stays unique at runtime * and consequently being uncancellable with the off method + * + * uniqueDelay calls are stacked on top of previous values of delay() and uniqueDelay() calls: + * + * uniqueDelay(100) ... -> executed 100 milliseconds after script start + * uniqueDelay(200) ... -> executed (100 + 200) milliseconds after script start */ const uniqueDelay = (delayInMs: number = 0) => { delayOffset += Math.floor(delayInMs)