Explorar el Código

chore(utils): 添加延时函数

wangcong hace 3 meses
padre
commit
ece071318c
Se han modificado 1 ficheros con 6 adiciones y 0 borrados
  1. 6 0
      src/utils/index.ts

+ 6 - 0
src/utils/index.ts

@@ -102,6 +102,12 @@ export const addUnit = (val: number, unit: string = 'px'): string => {
   return val + unit;
 };
 
+export const waitTime = async (time: number = 100) => {
+  await new Promise((resolve) => {
+    setTimeout(resolve, time);
+  });
+};
+
 export const downloadBlob = (blob: Blob, name: string) => {
   const url = window.URL.createObjectURL(blob);
   const a = document.createElement('a');