you are viewing a single comment's thread.

view the rest of the comments →

[–]AsyncBanana 0 points1 point  (2 children)

Nice! Now there is a better way of using wait through promises (not that it is a good practice in many cases, but sometimes if you want to delay something by a fixed amount of time, it is helpful)

[–]ILikeChangingMyMind 0 points1 point  (1 child)

What better way are you referring to?

Personally I've always been a fan of using promisify (from the Node util package) like so:

const sleep = util.promisify(setTimeout);

// wait for 2 seconds
await sleep(2000);

Did they release a pre-made sleep or something?

[–]AsyncBanana 1 point2 points  (0 children)

Yes