Add property that is updated via background polling
constseam=newSeam()seam.isHealthy// boolean
Allow configuring behavior
constseam=newSeam({pollHealth: true})seam.isHealthy// false// first health check happens right away, but needs to wait for at least next tick to updateawaitsleep(500)seam.isHealthy// true```tsconstseam=newSeam({pollHealth: {pollingInterval: 1000,timeout: 5000,// timeout error will set isHealthy falseonError: (err: Error)=>{console.log(err)}},})seam.isHealthy// falseawaitsleep(500)seam.isHealthy// trueconstseam=newSeam({pollHealth: false})seam.isHealthy// falseawaitseam.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.
Add property that is updated via background polling
Allow configuring behavior
By default,
{ pollHealth: false }.The
seam.isHealthyproperty should be implemented as a getter and will start false. It should throw if accessed but{ pollingInterval: false }orseam.updateHealthwas not called at least once.