From 83965e1b40424dee4fe28d3bacc4cc89e1a29beb Mon Sep 17 00:00:00 2001 From: luoyifan Date: Tue, 24 Jun 2025 14:18:41 +0800 Subject: [PATCH] =?UTF-8?q?system.sleep=20=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/runtime/System.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/runtime/System.ts b/src/runtime/System.ts index 480a866..76b0bf2 100644 --- a/src/runtime/System.ts +++ b/src/runtime/System.ts @@ -53,6 +53,17 @@ export default class System { } /** + * 延时函数 + */ + async sleep(timeOfMs: number = 1000): Promise { + return new Promise((resolve) => { + setTimeout(() => { + resolve() + }, timeOfMs) + }) + } + + /** * 轻量级提示信息 * @param message 消息内容 * @param type 消息类型,默认为 'info'