-
Couldn't load subscription status.
- Fork 1
Open
Labels
Description
Add property that is updated via background polling
const seam = new Seam()
seam.isHealthy // booleanAllow configuring behavior
const seam = new Seam({
pollHealth: true
})
seam.isHealthy // false
// first health check happens right away, but needs to wait for at least next tick to update
await sleep(500)
seam.isHealthy // true
```ts
const seam = new Seam({
pollHealth: {
pollingInterval: 1000,
timeout: 5000, // timeout error will set isHealthy false
onError: (err: Error) => { console.log(err) }
},
})
seam.isHealthy // false
await sleep(500)
seam.isHealthy // trueconst seam = new Seam({
pollHealth: false
})
seam.isHealthy // false
await seam.updateHealth()
seam.isHealthy // trueBy default, { pollHealth: false }.
The seam.isHealthy property should be implemented as a getter and will start false. It should throw if accessed but { pollingInterval: false } or seam.updateHealth was not called at least once.