import { EngineEventMap } from "@techsquidtv/canvas-timeline-core"; //#region src/hooks/core/useTimelineEvent.d.ts /** * Callback signature for a typed TimelineEngine event subscription. * * @template EventName - Timeline engine event name from `EngineEventMap`. * * @see {@link useTimelineEvent} * @see {@link https://canvastimeline.com/docs/events-and-lifecycle | Events and lifecycle} */ type TimelineEventHandler = (payload: EngineEventMap[EventName]) => void; /** Options for `useTimelineEvent`. */ interface TimelineEventOptions { /** Whether the subscription should be active. Defaults to true. */ enabled?: boolean; } /** * Subscribes to a typed TimelineEngine event with a React-safe latest handler. * * @remarks * * The hook keeps the event subscription stable while updating the callback ref * every render, avoiding stale closures without resubscribing for handler-only * changes. Use it for low-level integration work such as analytics, custom * status panels, or imperative bridges. Prefer focused hooks such as * {@link useTimelinePlayheadTime} or {@link useTimelineClipDropFeedback} when a * public hook already exists for the state you need. Events with `void` * payloads can still use zero-argument handlers. * * @param eventName - TimelineEngine event name to subscribe to. * @param handler - Callback invoked with the typed event payload. * @param options - Optional subscription controls. * @template EventName - Timeline engine event name from `EngineEventMap`. * @returns Nothing; the subscription is managed for the component lifetime. * * @example * ```tsx * import { useState } from 'react'; * import { useTimelineEvent } from '@techsquidtv/canvas-timeline-react'; * * export function PlaybackRateReadout() { * const [rate, setRate] = useState(1); * * useTimelineEvent('playback:rate', setRate); * * return {rate}x; * } * ``` * * @see {@link https://canvastimeline.com/docs/events-and-lifecycle | Events and lifecycle} */ declare function useTimelineEvent(eventName: EventName, handler: TimelineEventHandler, options?: TimelineEventOptions): void; //#endregion export { TimelineEventHandler, TimelineEventOptions, useTimelineEvent }; //# sourceMappingURL=useTimelineEvent.d.mts.map