import { Optional } from '../../utils/typescript-utils';
/**
 * Base event data.
 */
export interface EventData {
    /**
     * The name of the event.
     */
    eventName: string;
    /**
     * The Observable instance that has raised the event.
     */
    object: Observable;
}
export interface EventDataValue extends EventData {
    value?: boolean;
}
/**
 * Data for the "propertyChange" event.
 */
export interface PropertyChangeData extends EventData {
    /**
     * The name of the property that has changed.
     */
    propertyName: string;
    /**
     * The new value of the property.
     */
    value: any;
    /**
     * The previous value of the property.
     */
    oldValue?: any;
}
/**
 * Helper class that is used to fire property change even when real object is the same.
 * By default property change will not be fired for a same object.
 * By wrapping object into a WrappedValue instance `same object restriction` will be passed.
 */
export declare class WrappedValue {
    /**
     * Property which holds the real value.
     */
    wrapped: any;
    /**
     * Creates an instance of WrappedValue object.
     * @param wrapped - the real value which should be wrapped.
     */
    constructor(
    /**
     * Property which holds the real value.
     */
    wrapped: any);
    /**
     * Gets the real value of previously wrappedValue.
     * @param value - Value that should be unwraped. If there is no wrappedValue property of the value object then value will be returned.
     */
    static unwrap(value: any): any;
    /**
     * Returns an instance of WrappedValue. The actual instance is get from a WrappedValues pool.
     * @param value - Value that should be wrapped.
     */
    static wrap(value: any): any;
}
/**
 * Observable is used when you want to be notified when a change occurs. Use on/off methods to add/remove listener.
 * Please note that should you be using the `new Observable({})` constructor, it is **obsolete** since v3.0,
 * and you have to migrate to the "data/observable" `fromObject({})` or the `fromObjectRecursive({})` functions.
 */
export declare class Observable {
    /**
     * String value used when hooking to propertyChange event.
     * @nsEvent  {PropertyChangeData} propertyChange
     */
    static propertyChangeEvent: string;
    /**
     * Alternative to `instanceof ViewBase`.
     * @private
     */
    _isViewBase: boolean;
    private readonly _observers;
    /**
     * Gets the value of the specified property.
     */
    get(name: string): any;
    /**
     * Updates the specified property with the provided value.
     */
    set(name: string, value: any): void;
    /**
     * Updates the specified property with the provided value and raises a property change event and a specific change event based on the property name.
     */
    setProperty(name: string, value: any): void;
    /**
     * Adds a listener for the specified event name.
     *
     * @param eventName The name of the event.
     * @param callback The event listener to add. Will be called when an event of
     * the given name is raised.
     * @param thisArg An optional parameter which, when set, will be bound as the
     * `this` context when the callback is called. Falsy values will be not be
     * bound.
     */
    on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
    /**
     * Adds a listener for the specified event name, which, once fired, will
     * remove itself.
     *
     * @param eventName The name of the event.
     * @param callback The event listener to add. Will be called when an event of
     * the given name is raised.
     * @param thisArg An optional parameter which, when set, will be bound as the
     * `this` context when the callback is called. Falsy values will be not be
     * bound.
     */
    once(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
    /**
     * Removes the listener(s) for the specified event name.
     *
     * @param eventName The name of the event.
     * @param callback An optional specific event listener to remove (if omitted,
     * all event listeners by this name will be removed).
     * @param thisArg An optional parameter which, when set, will be used to
     * refine search of the correct event listener to be removed.
     */
    off(eventName: string, callback?: (data: EventData) => void, thisArg?: any): void;
    /**
     * Adds a listener for the specified event name.
     * @param eventName Name of the event to attach to.
     * @param callback A function to be called when some of the specified event(s) is raised.
     * @param thisArg An optional parameter which when set will be used as "this" in callback method call.
     * @param once An optional parameter which when set will cause the event listener to fire once.
     */
    addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: any, once?: boolean): void;
    /**
     * Removes listener(s) for the specified event name.
     * @param eventName Name of the event to attach to.
     * @param callback An optional parameter pointing to a specific listener. If not defined, all listeners for the event names will be removed.
     * @param thisArg An optional parameter which when set will be used to refine search of the correct callback which will be removed as event listener.
     */
    removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: any): void;
    /**
     * Please avoid using the static event-handling APIs as they will be removed
     * in future.
     * @deprecated
     */
    static on(eventName: string, callback: (data: EventData) => void, thisArg?: any, once?: boolean): void;
    /**
     * Please avoid using the static event-handling APIs as they will be removed
     * in future.
     * @deprecated
     */
    static once(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
    /**
     * Please avoid using the static event-handling APIs as they will be removed
     * in future.
     * @deprecated
     */
    static off(eventName: string, callback?: (data: EventData) => void, thisArg?: any): void;
    private static innerRemoveEventListener;
    /**
     * Please avoid using the static event-handling APIs as they will be removed
     * in future.
     * @deprecated
     */
    static removeEventListener(eventName: string, callback?: (data: EventData) => void, thisArg?: any): void;
    /**
     * Please avoid using the static event-handling APIs as they will be removed
     * in future.
     * @deprecated
     */
    static addEventListener(eventName: string, callback: (data: EventData) => void, thisArg?: any, once?: boolean): void;
    private _globalNotify;
    /**
     * Notify this Observable instance with some data. This causes all event
     * handlers on the Observable instance to be called, as well as any 'global'
     * event handlers set on the instance's class.
     *
     * @param data an object that satisfies the EventData interface, though with
     * an optional 'object' property. If left undefined, the 'object' property
     * will implicitly be set as this Observable instance.
     */
    notify<T extends Optional<EventData, 'object'>>(data: T): void;
    private static _fireEvent;
    private static _handleListenerEntry;
    /**
     * Notifies all the registered listeners for the property change event.
     */
    notifyPropertyChange(name: string, value: any, oldValue?: any): void;
    /**
     * Checks whether a listener is registered for the specified event name.
     * @param eventName The name of the event to check for.
     */
    hasListeners(eventName: string): boolean;
    /**
     * This method is intended to be overriden by inheritors to provide additional implementation.
     */
    _createPropertyChangeData(propertyName: string, value: any, oldValue?: any): PropertyChangeData;
    _emit(eventName: string): void;
    private _getEventList;
    private static _indexOfListener;
}
/**
 * Creates an Observable instance and sets its properties according to the supplied JavaScript object.
 * param obj - A JavaScript object used to initialize nativescript Observable instance.
 */
export declare function fromObject(source: any): Observable;
/**
 * Creates an Observable instance and sets its properties according to the supplied JavaScript object.
 * This function will create new Observable for each nested object (expect arrays and functions) from supplied JavaScript object.
 * param obj - A JavaScript object used to initialize nativescript Observable instance.
 */
export declare function fromObjectRecursive(source: any): Observable;
