queryBus.getListeners¶
The getListeners method allows to get all listeners of given message.
Input parameters¶
messageName¶
messageName is a mandatory parameter of the string type which represents the name of the message to get the listeners from.
Returned value¶
A returned value has a type of TMessageListener[] where TMessageListener represents the TMessageListener type
Example¶
To get all listeners for a given message using the Query Bus you can use the getListeners method:
useStorefront(async (storefront) => {
const listeners = storefront.queryBus.getListeners('my-query');
console.log('listeners of my-query:');
listeners.forEach((listener) => {
console.log('listener:', listener)
})
});