siwi-wait

wait for nodejs

Usage no npm install needed!

<script type="module">
  import siwiWait from 'https://cdn.skypack.dev/siwi-wait';
</script>

README

Build Status npm npm Github file size

siwi-wait

阻塞执行 在异步函数中等待指定时间

install

use npm

npm install siwi-wait

use yarn

yarn add siwi-wait

Example

const wait = require('siwi-wait')

class Example {
    constructor() {
        this.init()
    }
    async init () {
        await wait(10000)
        console.log(1)
    }
}

module.exports = new Example()

等待10秒后输出 1