Skip to content

Instantly share code, notes, and snippets.

View japorized's full-sized avatar

Japorized japorized

View GitHub Profile
/**
* This function should be used to get the state of promise after 'totalMilliseconds'
* the interval of checks can be configured by 'checkingInterval'
* @param promiseObject
* @param checkingInterval
* @param totalMilliseconds
* @returns {Promise<unknown>}
*/
const isPromiseResolved = async (promiseObject, checkingInterval, totalMilliseconds) => new Promise((resolve) => {
let timeUsed = 0;