Use-cases of subscribers for integration extension

The subscribers don't seem to have any context. Because of that I'm unsure how and why one would use subscribers besides the most basic logging to the console. https://docs.vuestorefront.io/sdk/advanced/extending-module#subscribers Can this be elaborated?
Vue Storefront Docs
Extending a Module
In most cases, a module exports the base set of communication methods and utilities.
3 Replies
David De Sloovere
David De SloovereOP15mo ago
It looks like you can pass in a generic params
subscribers: {
"*_before": (params: any) => {
console.log(`Before each * method do something`, params);
},
"*_after": () => {
console.log(`After each * method do something`);
}
}
subscribers: {
"*_before": (params: any) => {
console.log(`Before each * method do something`, params);
},
"*_after": () => {
console.log(`After each * method do something`);
}
}
`
skirianov
skirianov15mo ago
Yeah, you're right and as mentioned in the docs it's good to use them for logging or collecting analytics data. Subscribers don't affect the request/response since they are not blocking the request, but simply run in parallel with the request using pub-sub pattern.
David De Sloovere
David De SloovereOP15mo ago
Got it. Thanks for the response.
Want results from more Discord servers?
Add your server