Add pill beside title for full video reports

This commit is contained in:
Ajay
2022-01-05 02:35:58 -05:00
parent d36b4a54f3
commit 2883a50f27
6 changed files with 178 additions and 22 deletions

26
src/utils/genericUtils.ts Normal file
View File

@@ -0,0 +1,26 @@
/** Function that can be used to wait for a condition before returning. */
async function wait<T>(condition: () => T | false, timeout = 5000, check = 100): Promise<T> {
return await new Promise((resolve, reject) => {
setTimeout(() => {
clearInterval(interval);
reject("TIMEOUT");
}, timeout);
const intervalCheck = () => {
const result = condition();
if (result) {
resolve(result);
clearInterval(interval);
}
};
const interval = setInterval(intervalCheck, check);
//run the check once first, this speeds it up a lot
intervalCheck();
});
}
export const GenericUtils = {
wait
}