export declare type VdsEventInit = CustomEventInit & { readonly triggerEvent?: Event; }; export declare class VdsEvent extends CustomEvent { /** * The preceding event that was responsible for this event being fired. */ readonly triggerEvent?: Event; /** * Walks up the event chain (following each `triggerEvent`) and returns the origin event * that started the chain. */ get originEvent(): Event; /** * Walks up the event chain (following each `triggerEvent`) and determines whether the initial * event was triggered by the end user (ie: check whether `isTrusted` on the `originEvent` `true`). */ get isOriginTrusted(): boolean; constructor(type: string, eventInit?: VdsEventInit); } export declare type ExtractEventDetail = Event extends VdsEvent ? I : never; export declare type ExtractEventInit = VdsEventInit>; /** * Helps build a `VdsEvent` with type safety. * * @param type * @param eventInit */ export declare function vdsEvent(type: EventType, eventInit?: ExtractEventInit): GlobalEventHandlersEventMap[EventType]; export declare function isVdsEvent(event: Event | undefined): event is VdsEvent; /** * Walks up the event chain (following each `triggerEvent`) and returns the origin event * that started the chain. * * @param event */ export declare function getOriginEvent(event: VdsEvent): Event | undefined; export declare type WalkCallbackTypes = T | false | undefined | null | void; /** * Walks an event chain on a given `event`, and invokes the given `callback` for each * trigger event. * * @param event - The event on which to follow the chain. * @param callback - Invoked for each trigger event in the chain. If a `value` is returned by * this callback, the walk will end and `[event, value]` will be returned. */ export declare function walkTriggerEventChain(event: Event, callback: (event: Event) => NonNullable | void): [event: Event, value: NonNullable] | undefined; /** * Attempts to find a trigger event with a given `eventType` on the event chain. * * @param event - The event on which to look for a trigger event. * @param eventType - The type of event to find. */ export declare function findTriggerEvent(event: Event, eventType: T): GlobalEventHandlersEventMap[T] | undefined; /** * Whether a trigger event with the given `eventType` exists can be found in the event chain. * * @param event - The event on which to look for a trigger event. * @param eventType - The type of event to find. */ export declare function hasTriggerEvent(event: Event, eventType: T): boolean; /** * Appends the given `triggerEvent` to the event chain. This means the new origin event will be * the origin of the given `triggerEvent`, or the `triggerEvent` itself (if no chain exists on the * trigger). * * @param event - The event on which to extend the trigger event chain. * @param triggerEvent - The trigger event that will becoming the new origin event. */ export declare function appendTriggerEvent(event: VdsEvent, triggerEvent?: Event): void; //# sourceMappingURL=VdsEvent.d.ts.map