EventListenerOptions
interfaceSource L8Type contract for EventListenerOptions.
interface EventListenerOptions extends AddEventListenerOptionsMembers
| Name | Type | Default |
|---|---|---|
enabled? | boolean | true |
Open-code aq-ui React hook for Use Event Listener.
pnpm dlx aq-ui@alpha add use-event-listenerImport the parts you need, then jump to an export for its contract.
"use client"
import { useEventListener } from "@/hooks/use-event-listener"Type contract for EventListenerOptions.
interface EventListenerOptions extends AddEventListenerOptions| Name | Type | Default |
|---|---|---|
enabled? | boolean | true |
Open-code aq-ui React hook for Use Event Listener.
function useEventListener<TEvent extends Event>(target: Target<EventTarget> | undefined, eventName: string, handler: (event: TEvent) => void, { enabled = true, capture, once, passive, signal }: EventListenerOptions = {}): voidvoid| Name | Type | Default |
|---|---|---|
target | Target<EventTarget> | undefined | — |
eventName | string | — |
handler | (event: TEvent) => void | — |
options? | EventListenerOptions | {} |
hook-target, use-stable-callback