Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created December 9, 2022 01:03
Show Gist options
  • Save miguelmota/091e4f53a3fe704b08fac6424df3089c to your computer and use it in GitHub Desktop.
Save miguelmota/091e4f53a3fe704b08fac6424df3089c to your computer and use it in GitHub Desktop.
TypeScript wait tilReady
import wait from 'wait'
class MyClass {
ready = false
async tilReady (): Promise<boolean> {
if (this.ready) {
return true
}
await wait(100)
return await this.tilReady()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment