rx-player
Version:
Canal+ HTML5 Video Player
15 lines (14 loc) • 332 B
JavaScript
/**
* Convert a setTimeout to a Promise.
*
* You can use it to have a much more readable blocking code with async/await
* in some asynchronous tests.
*
* @param {number} timeInMs
* @returns {Promise}
*/
export default function sleep(timeInMs) {
return new Promise((res) => {
setTimeout(res, timeInMs);
});
}