@chengaoyuan/sleep

基于Promise的sleep

Usage no npm install needed!

<script type="module">
  import chengaoyuanSleep from 'https://cdn.skypack.dev/@chengaoyuan/sleep';
</script>

README

sleep

npm version install size NPM Downloads Build Status Coverage Status

Installation

$ npm install @chengaoyuan/sleep

Usage

import sleep from "@chengaoyuan/sleep";
async function func() {
    console.log(Date.now());
    await sleep(1000); // sleep 1s
    console.log(Date.now());
}
func();

Testing

$ npm test