import { App } from "../App";
import { IDisposable } from "../core/types";
import { viewModelInitFunc } from "./baseTypes";
/**
 * Useful only for Unit testing, this function will await till initialization is
 * complete and all pending functions are executed
 */
export declare function waitForReady(vm: AtomViewModel): Promise<any>;
/**
 * ViewModel class supports initialization and supports {@link IDisposable} dispose pattern.
 * @export
 * @class AtomViewModel
 */
export declare class AtomViewModel {
    readonly app: App;
    postInit: Function[];
    private disposables;
    private validations;
    private pendingInits;
    /**
     * If it returns true, it means all pending initializations have finished
     */
    get isReady(): boolean;
    get errors(): Array<{
        name: string;
        error: string;
    }>;
    private mChildren;
    private mParent;
    private mShouldValidate;
    /**
     * Returns parent AtomViewModel if it was initialized with one. This property is also
     * useful when you open an popup or window. Whenever a popup/window is opened, ViewModel
     * associated with the UI element that opened this popup/window becomes parent of ViewModel
     * of popup/window.
     */
    get parent(): AtomViewModel;
    set parent(v: AtomViewModel);
    /**
     * Returns true if all validations didn't return any error. All validations
     * are decorated with @{@link Validate} decorator.
     */
    get isValid(): boolean;
    constructor(app: App);
    /**
     * Resets validations and all errors are removed.
     * @param resetChildren reset child view models as well. Default is true.
     */
    resetValidations(resetChildren?: boolean): void;
    /**
     * Runs function after initialization is complete.
     * @param f function to execute
     */
    runAfterInit(f: () => void): void;
    /**
     * Refreshes bindings associated with given property name
     * @param name name of property
     */
    refresh(name: string): void;
    /**
     * Put your asynchronous initialization here
     *
     * @returns {Promise<any>}
     * @memberof AtomViewModel
     */
    init(): Promise<any>;
    /**
     * dispose method will be called when attached view will be disposed or
     * when a new view model will be assigned to view, old view model will be disposed.
     *
     * @memberof AtomViewModel
     */
    dispose(): void;
    /**
     * Register a disposable to be disposed when view model will be disposed.
     *
     * @protected
     * @param {IDisposable} d
     * @memberof AtomViewModel
     */
    registerDisposable(d: IDisposable): IDisposable;
    protected onReady(): void;
    /**
     * Execute given expression whenever any bindable expression changes
     * in the expression.
     *
     * For correct generic type resolution, target must always be `this`.
     *
     *      this.setupWatch(() => {
     *          if(!this.data.fullName){
     *              this.data.fullName = `${this.data.firstName} ${this.data.lastName}`;
     *          }
     *      });
     *
     * @protected
     * @template T
     * @param {() => any} ft
     * @returns {IDisposable}
     * @memberof AtomViewModel
     */
    protected setupWatch(ft: string[][] | (() => any), proxy?: (...v: any[]) => void, forValidation?: boolean, name?: string): IDisposable;
    protected onPropertyChanged(name: string): void;
}
/**
 * Receive messages for given channel
 * @param {(string | RegExp)} channel
 * @returns {Function}
 */
export declare function Receive(...channel: string[]): viewModelInitFunc;
export declare function BindableReceive(...channel: string[]): viewModelInitFunc;
export declare function BindableBroadcast(...channel: string[]): viewModelInitFunc;
export declare function Watch(target: AtomViewModel, key: string | symbol, descriptor: any): void;
/**
 * Cached watch must be used with async getters to avoid reloading of
 * resources unless the properties referenced are changed
 * @param target ViewModel
 * @param key name of property
 * @param descriptor descriptor of property
 */
export declare function CachedWatch(target: AtomViewModel, key: string, descriptor: any): void;
export declare function Validate(target: AtomViewModel, key: string | symbol, descriptor: any): void;
//# sourceMappingURL=AtomViewModel.d.ts.map