@tempots/ui

handleAnchorClick() function

Handles anchor click events, optionally checking for external URLs and file extensions.

Signature:

handleAnchorClick: (callback: () => boolean, options?: HandleAnchorClickOptions) => (e: MouseEvent) => void

Parameters

Parameter

Type

Description

callback

() => boolean

A function that is called when the anchor click should be handled. The function should return a boolean indicating whether the default anchor click behavior should be prevented.

options

HandleAnchorClickOptions

(Optional) An optional object of type HandleAnchorClickOptions.

Returns: (e: MouseEvent) => void

A function that handles the anchor click event, calling the provided callback and preventing the default behavior if the callback returns true.