@dofiltra/helpers
Advanced tools
Comparing version 1.0.55 to 1.0.56
@@ -272,1 +272,9 @@ import type { TDodecoratorSettings, TResultError, TTrackMetadata } from '@dofiltra/types'; | ||
} | ||
export declare class Dowaiter { | ||
static while({ condition, ms, timeout, msg }: { | ||
condition: () => Promise<boolean>; | ||
ms?: number; | ||
timeout?: number; | ||
msg?: string; | ||
}): Promise<void>; | ||
} |
@@ -883,6 +883,16 @@ /* tslint:disable:max-classes-per-file */ | ||
//#endregion TIMELINE | ||
//#region WAITER | ||
export class Dowaiter { | ||
static async while({ condition, ms = 1e3, timeout, msg }) { | ||
let nowMs = 0; | ||
while ((await condition()) && (!timeout || nowMs < timeout)) { | ||
await sleep(ms); | ||
nowMs += ms; | ||
msg && console.log(msg, `${nowMs / 1e3}s`); | ||
} | ||
} | ||
} | ||
//#endregion WAITER | ||
//#region COMMON | ||
//#endregion COMMON | ||
//#region COMMON | ||
//#endregion COMMON | ||
//#region CIPHER | ||
@@ -889,0 +899,0 @@ // export class CipherHelper { |
{ | ||
"name": "@dofiltra/helpers", | ||
"version": "1.0.55", | ||
"version": "1.0.56", | ||
"license": "MIT", | ||
@@ -29,3 +29,3 @@ "main": "./lib/index.js", | ||
"devDependencies": { | ||
"@dofiltra/types": "^1.0.219", | ||
"@dofiltra/types": "^1.0.222", | ||
"@types/node": "^20.8.0", | ||
@@ -32,0 +32,0 @@ "prettier": "^3.0.3", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
114698
2181