import type Collection from "@arcgis/core/core/Collection";
import type { Evented, EventedCallback, EventNames } from "@arcgis/core/core/Evented";
import type { CollectionChangeEvent } from "../support/esri.js";
import { type IHandle, type Observable } from "../support/observableUtils.js";
/**
 * Listens for an event on each item in a collection.
 *
 * @param collection The collection of items to watch.
 * @param eventType The event type to listen for.
 * @param callback The callback to invoke.
 */
export declare function onEach<T extends Evented>(collection: Collection<T>, eventType: EventNames<T>, callback: EventedCallback<T["@eventTypes"][EventNames<T>]>): IHandle;
/**
 * Listens to change events on a collection property. This function also handles
 * the case where the collection property itself is changed, in addition to
 * items being added or removed to the collection. If the collection property is
 * changed, it will automatically start watching the new collection if there is
 * one and stop watching the old. In this case it will calculate the difference
 * between the two collections and emit a "change" event with the appropriate
 * values for event.added, event.removed, etc.
 *
 * Because this function calculates the difference between property changes it
 * is best to avoid using this function if you are only interested in the
 * collection changed event occurring and not the items that were added or
 * removed. In that case, use {@link support/observableUtils!watchEvent}
 * instead.
 *
 * @param obj The object that owns the collection property to watch.
 * @param path The collection property to watch.
 * @param callback The callback to invoke when the collection changes.
 * @param sync Whether to invoke the callback synchronously. The default is
 *   `false`.
 */
export declare function onCollectionPropertyChange<T>(obj: Observable, path: string, callback: EventedCallback<CollectionChangeEvent<T>>, sync?: boolean): IHandle;
/**
 * Listens for an emitted event from an object and executes a callback only once
 * before removing the listener.
 *
 * @param obj The object to listen to.
 * @param eventName The name of the event to listen for.
 * @param listener The callback to execute once the event is emitted.
 */
export declare function onOnce<T extends Evented>(obj: T, eventName: EventNames<T>, listener: EventedCallback<T["@eventTypes"][typeof eventName]>): IHandle;
