resilient.js
resilient.js copied to clipboard
Support observer hooks
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...
})