If I have this
class Foo {
constructor(obj:number) {
// run "Run"
// run "Run" after 1 second after each time it finishes
}
private async Run(obj:number):Promise<void> {
// some code does uses await
}
}
when the instance is created, I want it to run Run, and when it finishes it waits 1 second and then it runs Run again, in an infinite loop, but using setTimeout. Also the Run doesn't return any value so it can be void.
How can I do this?
while (true) { await delay(1000); … }