Skip to content

Commit

Permalink
chore: tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Dec 15, 2024
1 parent 7a73daa commit ec77786
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions companion/lib/Internal/BuildingBlocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,16 @@ export class InternalBuildingBlocks implements InternalModuleFragment {

executeAction(action: ActionInstance, extras: RunActionExtras): Promise<boolean> | 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

Expand Down

0 comments on commit ec77786

Please sign in to comment.