eventBus.offAll¶
The offAll
method allows to remove all listeners from the given event.
Input parameters¶
messageName¶
messageName
is a mandatory parameter of the string
type which represents the name of the targeted message.
Example¶
To remove all listeners from any event of the Event Bus you can use the offAll
method:
useStorefront(async (storefront) => {
function myFunction(event) {
console.log('Event:', event.name);
}
storefront.eventBus.on(myFunction);
storefront.eventBus.offAll(myFunction);
});