From 79c9d4424f96a55aee5378d190da593248ebf127 Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Tue, 6 Jun 2023 21:03:39 -0400 Subject: [PATCH] feat: add sleep util --- legacy/src/utils.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/legacy/src/utils.ts b/legacy/src/utils.ts index d407dfe5..447a7bc9 100644 --- a/legacy/src/utils.ts +++ b/legacy/src/utils.ts @@ -3,3 +3,6 @@ export const extractJSONObjectFromString = (text: string): string | undefined => export const extractJSONArrayFromString = (text: string): string | undefined => text.match(/\[(.|\n)*\]/gm)?.[0] + +export const sleep = (ms: number) => + new Promise((resolve) => setTimeout(resolve, ms))