Suppose I have the following setup:
class Foo {
constructor(obj:number) {
// execute "Run"
// call "Run" again after 1 second following each completion
}
private async Run(obj:number):Promise<void> {
// includes code that utilizes await
}
}
Upon creating an instance of this class, my goal is to continuously run the Run
function in an infinite loop. After each execution of Run
, there should be a one-second delay before it runs again using the method setTimeout
. Additionally, since Run
does not return any value, it can be considered void.
How would I go about accomplishing this?