import { EventGuard } from "../../../eventDispatcher/api/EventGuard"; import { Event } from "../../../eventDispatcher/event/Event"; import { Type } from "../../../type/Type"; import { Command } from "../../command/Command"; import { CommandMapping } from "../CommandMapping"; /** * Data object to store event command mapping data. */ export declare class CommandMappingImpl implements CommandMapping { readonly eventType: Event['type']; readonly command: Type; private guards; private _eventClass; private _executeOnce; /** * Create new command mapping. * @param eventType Event type command is mapped to. * @param command Command class which to execute as event is encountered. */ constructor(eventType: Event['type'], command: Type); /** * Event class type to get explicit event source filter. * Default value for this property is Event, hence it will work for any Event and its subclasses. * @returns {Type} */ get eventClass(): Type; /** * Defines if this command mapping should be executed only once. * @returns {boolean} */ get executeOnce(): boolean; /** * Mark command mapping to be executed only once. */ once(): this; /** * Set event guards which could prevent command to be executed upon some circumstances known only to * guard. * @param guards List of Guards that might prevent execution of command. * @returns {CommandMappingImpl} so we can call other methods of this class instantly from return value */ withGuards(...guards: EventGuard[]): this; /** * Find if event execution is allowed by guards. * @param event Event object data. * @returns {boolean} True if guards aren't set or none of them has reason to stop execution. */ executionAllowedByGuards(event: Event): boolean; }