import { Observable } from "rxjs/Rx"; import { Scheduler } from "rxjs/Scheduler"; /** * Defines a class that represents a command that can run operations in the background. */ export declare class ReactiveCommand { private task; private canRun; private scheduler; private _executionInfo; private _synchronizedExcecutionInfo; private _results; private _canExecute; private _isExecuting; private _canExecuteSubscription; private _exceptions; /** * Gets an observable that represents whether the command is currently executing. */ readonly isExecuting: Observable; /** * Gets an observable that represents whether this command can execute. */ readonly canExecute: Observable; /** * Creates a new Reactive Command. * @param canRun An observable that determines whether the given task is allowed to run at a given moment. * @param task A function that returns an observable that represents the asynchronous operation. * @param scheduler The scheduler that all of the results should be observed on. */ constructor(task: (args: TArgs) => Observable, canRun: Observable, scheduler: Scheduler); private static defaultScheduler(scheduler); private static defaultCanRun(canRun); /** * Creates a new Reactive Command that can run the given synchronous task when executed. * @param task A function that executes some synchronous task and returns an optional value. * @param canRun An Observable whose stream of values determine whether the command is allowed to run at a certain time. * @param scheduler The scheduler that all of the results from the task should be observed on. */ static create(task: (args: TArgs) => (TResult | void), canRun?: Observable, scheduler?: Scheduler): ReactiveCommand; /** * Creates a new Reactive Command that can run the given task when executed. * @param task A function that returns a promise that completes when the task has finished executing. * @param canRun An Observable whose stream of values determine whether the command is allowed to run at a certain time. * @param scheduler The scheduler that all of the results from the task should be observed on. */ static createFromTask(task: (args: TArgs) => Promise, canRun?: Observable, scheduler?: Scheduler): ReactiveCommand; /** * Creates a new Reactive Command that can run the given task when executed. * @param task A function that returns an observable that completes when the task has finished executing. * @param canRun An Observable whose stream of values determine whether the command is allowed to run at a certain time. * @param scheduler The scheduler that all of the results from the task should be observed on. */ static createFromObservable(task: (args: TArgs) => Observable, canRun?: Observable, scheduler?: Scheduler): ReactiveCommand; /** * Executes this command asynchronously. * Note that this method does not check whether the command is currently executable. */ execute(arg?: TArgs): Observable; /** * Executes this command asynchronously if the latest observed value from canExecute is true. */ invoke(arg?: TArgs): Observable; /** * Gets an observable that determines whether the command is able to execute at the moment it is subscribed to. */ canExecuteNow(): Observable; /** * Gets the observable that represents the results of this command's operations. */ readonly results: Observable; }