commandBus.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 command.
Example¶
To get the count of all listeners for a given message using the Command Bus you can use the getListenersCount method:
useStorefront(async (storefront) => {
const listenersCount = storefront.commandBus.getListenersCount('my-command');
console.log('listeners of my-command:', listenersCount);
});