Sleep while function returns true
Return true to continue
Run function ever x milliseconds
Callback when sleep is over
let loading = true;setTimeout(() => wait = false, 1000);await sleepWhile(() => loading); // Won't continue until loading flag is false Copy
let loading = true;setTimeout(() => wait = false, 1000);await sleepWhile(() => loading); // Won't continue until loading flag is false
Sleep while function returns true