mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
13 lines
294 B
JavaScript
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
|