DEV Community 👩‍💻👨‍💻

Marques Traylor
Marques Traylor

Posted on

await Sleep(x);

If you're looking for a quick way to pause runtime while you:

  • Wait for a response
  • Making sure a variable updated successfully
  • etc...

async/await sleep

Alt Text

The len param is measured in milliseconds.


Alt Text

Sauce.sleep(15000); Resolves after 15 seconds

The transaction would resolve before the balance updated so I paused the script for 15 seconds while the transaction was being mined.

Hope this helps!

Top comments (2)

shane profile image
Shane McGowan

You have a small typo in "The len param is measured in seconds" it should be say milliseconds, not seconds

traylorboy profile image
Marques Traylor

Hahaha of course, thanks man! Completely missed that.

Let's Get Hacking

Join the DEV x Linode Hackathon 2022 and use your ingenuity and creativity to build using Linode.

Join the Hackathon <-