Reputation: 111
I have a function that must finish its job to restart again, and that for infinite time in nodejs.
So I just want to create an infinite loop, synchronous, that only execute on function.
I tried a lot of things, but all I tested didn't worked.
In other synchronous languages, this function will looks like :
while(42) {
myfunc();
}
And this function returns a promise.
Can you help me please ?
Upvotes: 1
Views: 838
Reputation: 45121
"And this function returns a promise."
myfunc().then(myfunc)
UPD. Demo.
function run() {
myfunc().then(run)
}
run()
Upvotes: 3