From ec77786aa5597a6bc049d26bf0d63b5130730b83 Mon Sep 17 00:00:00 2001 From: Julian Waller Date: Sun, 15 Dec 2024 13:54:08 +0000 Subject: [PATCH] chore: tidy --- companion/lib/Internal/BuildingBlocks.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/companion/lib/Internal/BuildingBlocks.ts b/companion/lib/Internal/BuildingBlocks.ts index 9dc399390..d400118b9 100644 --- a/companion/lib/Internal/BuildingBlocks.ts +++ b/companion/lib/Internal/BuildingBlocks.ts @@ -146,17 +146,16 @@ export class InternalBuildingBlocks implements InternalModuleFragment { executeAction(action: ActionInstance, extras: RunActionExtras): Promise | boolean { if (action.action === 'wait') { - return Promise.resolve().then(async () => { - if (extras.abortDelayed.aborted) return true - - const delay = Number(action.options.time) - if (!isNaN(delay) && delay > 0) { - // Perform the wait - await new Promise((resolve) => setTimeout(resolve, delay)) - } + if (extras.abortDelayed.aborted) return true + const delay = Number(action.options.time) + if (!isNaN(delay) && delay > 0) { + // Perform the wait + return new Promise((resolve) => setTimeout(resolve, delay)).then(() => true) + } else { + // No wait, return immediately return true - }) + } } else if (action.action === 'action_group') { if (extras.abortDelayed.aborted) return true