mirror of
https://github.com/motajs/template.git
synced 2026-11-28 17:04:30 +08:00
init: 2.B
This commit is contained in:
commit
6bf32174d8
610 files changed
+151444
No files matched your search
@@ -0,0 +1,24 @@
|
||||
# @motajs/common 函数
|
||||
|
||||
## `sleep`
|
||||
|
||||
```ts
|
||||
function sleep(time: number): Promise<void>;
|
||||
```
|
||||
|
||||
#### 描述
|
||||
|
||||
创建一个等待指定时长的异步。
|
||||
|
||||
#### 参数
|
||||
|
||||
- `time`: 等待时长
|
||||
|
||||
#### 使用示例
|
||||
|
||||
```ts
|
||||
async function myFunc() {
|
||||
await sleep(1000);
|
||||
// 这后面的内容会在 1 秒之后执行
|
||||
}
|
||||
```
|
||||
Reference in new issue
Block a user