resilient.js icon indicating copy to clipboard operation
resilient.js copied to clipboard

Support observer hooks

Open h2non opened this issue 10 years ago • 0 comments

Replace events in favor of observer hooks with control flow capabilities.

const client = resilient({})

client.observe('before request', function (ctx, next) {
 // logic goes here...  
})

client.observe('dialing', function (ctx, next) {
 // logic goes here...  
})

client.observe('retry', function (ctx, next) {
 // logic goes here...  
})

client.observe('response', function (ctx, next) {
 // logic goes here...  
})

h2non avatar Dec 09 '15 10:12 h2non