import { Subscription } from "rxjs/Rx"; /** * Defines an interface that represents a handler function for an interaction. * These functions return a value (either null or a value of type TOutput) upon handling the * interaction, or undefined if the handler is not able to handle the interaction. */ export interface IReactiveInteractionHandler { (param: TInput): TOutput | Promise; } /** * Defines a class that represents an interaction. * Interactions are designed to provide a means of resolving view-specific input mechanisms that occur * during an operation that a ReactiveObject is performing. */ export declare class ReactiveInteraction { private _handlerChain; /** * Adds the given handler to the beginning of the handler chain for this interaction and returns * a subscription that, when unsubscribed from, removes the handler from the handler chain. * @param handler The function that can handle the interaction. */ registerHandler(handler: IReactiveInteractionHandler): Subscription; /** * Attempts to handle an interaction. Returns a promise that represents the async operation. * By default, handlers are called from most recently registered to least recently registered. * If a handler returns (note that if the handler resolves a promise with undefined, that will be used as the output) undefined, then the next handler in line is called. * If a handler errors, then the entire chain errors and the error is surfaced through the returned promise. * @param param The input that should be provided to the handler. */ handle(param?: TInput): Promise; }