export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
export const awaitTime = async (cb, ms) => {
const start = new Date().getTime();
const res = await cb();
const end = new Date().getTime();
if (end - start < ms) {
await new Promise((resolve) => {
setTimeout(resolve, ms - (end - start));
});
}
return res;
};