import type { Actor, IAction, IActorOutput, IActorTest } from './Actor'; import type { Bus } from './Bus'; /** * An ActionObserver can passively listen to {@link Actor#run} inputs and outputs for all actors on a certain bus. * * ActionObserver should not edit inputs and outputs, * they should be considered immutable. * * @see Actor * @see Bus * * @template I The input type of an actor. * @template O The output type of an actor. */ export declare abstract class ActionObserver { readonly name: string; readonly bus: Bus, I, IActorTest, O>; /** * All enumerable properties from the `args` object are inherited to this observer. * * The observer will NOT automatically subscribe to the given bus when this constructor is called. * * @param {IActionObserverArgs} args Arguments object * @throws When required arguments are missing. */ protected constructor(args: IActionObserverArgs); /** * Invoked when an action was run by an actor. * * @param actor The action on which the {@link Actor#run} method was invoked. * @param {I} action The original action input. * @param {Promise} output A promise resolving to the final action output. */ abstract onRun(actor: Actor, action: I, output: Promise): void; } export interface IActionObserverArgs { /** * The name for this observer. * @default {} */ name: string; /** * The bus this observer can subscribe to. */ bus: Bus, I, IActorTest, O>; }