Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const interval = async (msFunc, callback, continueCond) => {
const _interval = async () => {
const sleepTime = msFunc();
console.log("sleepTime: ", sleepTime);
await new Promise(resolve => {
setTimeout(resolve, sleepTime);
if (continueCond()) {
await _interval();
await _interval();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.