orbitdb/test/utils/wait-for.js
2023-02-16 10:18:39 +02:00

13 lines
294 B
JavaScript

const waitFor = async (valueA, toBeValueB, pollInterval = 100) => {
return new Promise((resolve) => {
const interval = setInterval(() => {
if (valueA() === toBeValueB()) {
clearInterval(interval)
resolve()
}
}, pollInterval)
})
}
export default waitFor