소스 검색

chore(utils): 添加延时函数

wangcong 3 달 전
부모
커밋
ece071318c
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  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');