mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-22 01:19:13 +01:00
Proto selection UI/models
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
import { sleep } from './sleep';
|
||||
|
||||
/** Ensures a promise takes at least a certain number of milliseconds to resolve */
|
||||
export async function minPromiseMillis<T>(promise: Promise<T>, millis: number) {
|
||||
const start = Date.now();
|
||||
const result = await promise;
|
||||
let result;
|
||||
let err;
|
||||
|
||||
try {
|
||||
result = await promise;
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
|
||||
const delayFor = millis - (Date.now() - start);
|
||||
await sleep(delayFor);
|
||||
return result;
|
||||
if (err) throw err;
|
||||
else return result;
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ export interface GrpcRequest extends BaseModel {
|
||||
service: string | null;
|
||||
method: string | null;
|
||||
message: string;
|
||||
protoFiles: string[];
|
||||
}
|
||||
|
||||
export interface GrpcMessage extends BaseModel {
|
||||
|
||||
Reference in New Issue
Block a user