February 11, 2020
Typescript delay with async/await
Sometimes it is necessary in JavaScript to delay/sleep a program for a certain time. Therefore we can generate this behavior ourselves using a small helper function, thanks to the asynchronous nature of javascript. For example: function sleep(ms: number) { return new Promise(resolve =>; setTimeout(resolve, ms)); } With this we can delay the program flow for […]
READ MORE