Skip to content

Commit

Permalink
fix: Fix delay between each run in waitDelay
Browse files Browse the repository at this point in the history
  • Loading branch information
windowsair authored and thegecko committed May 25, 2024
1 parent 6a33cc9 commit a0e8075
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/dap/adi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ export class ADI implements DAP {
* Continually run a function until it returns true
* @param fn The function to run
* @param timeout Optional timeout to wait before giving up and throwing
* @param timer The milliseconds to wait between each run
* @param delay The milliseconds to wait between each run
* @returns Promise
*/
protected async waitDelay(fn: () => Promise<boolean>, timeout: number = 0, timer: number = DEFAULT_WAIT_DELAY): Promise<void> {
protected async waitDelay(fn: () => Promise<boolean>, timeout: number = 0, delay: number = DEFAULT_WAIT_DELAY): Promise<void> {
let running = true;

if (timeout > 0) {
Expand All @@ -92,8 +92,8 @@ export class ADI implements DAP {
return;
}

if (timer > 0) {
await new Promise(resolve => setTimeout(resolve, timeout));
if (delay > 0) {
await new Promise(resolve => setTimeout(resolve, delay));
}
}
}
Expand Down

0 comments on commit a0e8075

Please sign in to comment.