mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-20 07:51:20 +02:00
Show response headers
This commit is contained in:
9
src-web/lib/minPromiseMillis.ts
Normal file
9
src-web/lib/minPromiseMillis.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { sleep } from './sleep';
|
||||
|
||||
export async function minPromiseMillis<T>(promise: Promise<T>, millis: number) {
|
||||
const start = Date.now();
|
||||
const result = await promise;
|
||||
const delayFor = millis - (Date.now() - start);
|
||||
await sleep(delayFor);
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user