Home > @shopware-pwa/composables > useIntercept

# useIntercept() function

Allows to broadcast and intercept events across application.

Signature:

export declare function useIntercept(): {
    broadcast: (broadcastKey: string, value?: any) => void;
    intercept: (broadcastKey: string, handler: IInterceptorCallbackFunction) => void;
    disconnect: (broadcastKey: string, interceptor: string | IInterceptorCallbackFunction) => void;
    on: (params: {
        broadcastKey: string;
        name: string;
        handler: IInterceptorCallbackFunction;
    }) => void;
};

Returns:

{ broadcast: (broadcastKey: string, value?: any) => void; intercept: (broadcastKey: string, handler: IInterceptorCallbackFunction) => void; disconnect: (broadcastKey: string, interceptor: string | IInterceptorCallbackFunction) => void; on: (params: { broadcastKey: string; name: string; handler: IInterceptorCallbackFunction; }) => void; }