I am using the following library to have some delay in a promise:
const prom = require('util').promisify;
const delayedProm = prom(setTimeout);
i have two nested loops inside '.then(())', and in the inner loop there is if-condition. when this if-condition is satisfied i want to delay to certain amount of time, then the loop should continue normally. the promise should be resolved and returned when the two loops finish iterations.
please let me know how to achieve that sync and async
code:
return func()
.then((execs) => {
for () {
for () {
if (condition) {
dely(interval)
}
}
}
return resolvedPromise
})