Answers for "aysnc sleep"

1

sleeping in js

function sleep(milliseconds) {
  var start = new Date().getTime();
  for (var i = 0; i < 1e7; i++) {
    if ((new Date().getTime() - start) > milliseconds){
      break;
    }
  }
}

//using sleep()
sleep(2000); //sleep for 2 seconds
Posted by: Guest on June-22-2020
0

async sleep python

import asyncio
await asyncio.sleep(1)
Posted by: Guest on December-08-2020

Python Answers by Framework

Browse Popular Code Answers by Language