Home > @dinofe/xt-core > delay

# delay() function

延迟

Signature:

export declare function delay(time?: number): Promise<unknown>;

# Parameters

Parameter Type Description
time number (Optional) 延迟时间(毫秒)

Returns:

Promise<unknown>

返回 Promise 对象

# Example

import { delay } from '@dinofe/xt-core/common'
async function fn1() {
 await delay(3000)
 console.log('foo') // 3s 之后才打印 foo
}