Skip to content

Commit

Permalink
export UseAnchor subtypes:
Browse files Browse the repository at this point in the history
- AnchorAssign
- AnchorAttributes
- AnchorOnClick
  • Loading branch information
Stassi committed Nov 15, 2024
1 parent ed45db2 commit 8c39d03
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/leaf/map/fullscreen/state/use-anchor.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { DomEvent } from 'leaflet'

export type AnchorAttributes = Record<string, string>
export type UseAnchorOptions = {
attributes: Record<string, string>
attributes: AnchorAttributes
element: HTMLElement
}

export type AnchorAssign = (props: AnchorAttributes) => HTMLElement
export type AnchorOnClick = (handler: (event: Event) => Promise<void>) => void
export type UseAnchor = {
assign: (props: Record<string, string>) => HTMLElement
onClick: (handler: (event: Event) => Promise<void>) => void
assign: AnchorAssign
onClick: AnchorOnClick
}

const domEventOn = <
Expand All @@ -22,7 +25,7 @@ export function useAnchor({
attributes,
element,
}: UseAnchorOptions): UseAnchor {
function assign(anchorAttributes: Record<string, string>): HTMLElement {
function assign(anchorAttributes: AnchorAttributes): HTMLElement {
return Object.assign(element, anchorAttributes)
}

Expand Down

0 comments on commit 8c39d03

Please sign in to comment.