logo

sleep

The sleep function takes a number of milliseconds and returns a promise that resolves after that many milliseconds.

import { sleep } from '@aracna/core';

(async () => {
  console.log('before sleep', Date.now());
  await sleep(2000);
  console.log('after sleep', Date.now());
})();