queryBus.getListenersCount¶
The getListenersCount
method allows to get the count of 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 count from.
Returned value¶
A returned value has a type of number
representing a number of listeners for the given query.
Example¶
To get the count of all listeners for a given message using the Query Bus you can use the getListenersCount
method:
useStorefront(async (storefront) => {
const listenersCount = storefront.queryBus.getListenersCount('my-query');
console.log('listeners of my-query:', listenersCount);
});