/** Middleware interface to respect to chain middleware in a composition */ export interface HyperlinkProperties { href: string; target: string; } /** Middleware interface to respect to chain middleware in a composition */ export declare type MiddlewareNext = (properties?: HyperlinkProperties) => void; export declare type Middleware = (properties: HyperlinkProperties, element: Node | null, // Allow having the clicked element in case we want to deal with it (modify a class, animate it...) next: MiddlewareNext) => void; /** Its instance allows you to chain middlewares */ export declare class MiddlewareComposition { protected readonly middlewares: Middleware[]; constructor(...mdws: Middleware[]); /** Allow adding middleware after initialization */ add(mdw: Middleware): void; /** Pass the parameters through the middlewares chain */ apply(properties: HyperlinkProperties, element?: Element): HyperlinkProperties; /** * Pass a link through the middlewares chain. This usage is likely to be used when you do not deal with the HTML DOM, for example when you redirect a user within a framework without any anchor tag (``) * * Note: if any of the middleware is trying to deal with the anchor element, it will be ignored */ applyToLink(href: string): string; }