Skip to content

menuContentConnected

menuContentConnected is a DOM event that occurs whenever the menu content element fires the connectedCallback lifecycle method.

Event body

The menuContentConnected body has a TMenuContentConnectedEventDetail type which represents the details of the connected menu content element. It is optional so it might not exist.

Example

In this example we listen to menuContentConnected event and perform an action whenever it's emitted.

useStorefront(async (storefront) => {
    document.addEventListener('menuContentConnected', (event) => {
        const $menuContent = event.detail?.$el;

        console.log('Menu content has been connected', $menuContent);
    });
});