import { FlowAnyExistential, FlowAnyObject } from './private_utils'; /** * Abstract superclass for watchable models. All watchable models expose `watch` * and `unwatch` methods that allow consumers to subscribe to changes to that model. * * This class should not be used directly. * * @docsPath models/advanced/Watchable */ declare class Watchable { /** @internal */ static _className: string; /** @internal */ static _isWatchableKey(_key: string): boolean; /** @internal */ _changeCount: number; /** @internal */ readonly _watchableId: string; /** @internal */ _changeWatchersByKey: { [key: string]: Array<{ callback: (model: Watchable, key: WatchableKey, ...args: Array) => unknown; context: FlowAnyObject | null | undefined; }>; }; /** * @internal */ constructor(); /** * @internal */ __getWatchableKey(): string; /** * Get notified of changes to the model. * * Every call to `.watch` should have a matching call to `.unwatch`. * * Returns the array of keys that were watched. * * @param keys the keys to watch * @param callback a function to call when those keys change * @param context an optional context for `this` in `callback`. */ watch(keys: WatchableKey | ReadonlyArray, callback: (model: this, key: WatchableKey, ...args: Array) => unknown, context?: FlowAnyObject | null): Array; /** * Unwatch keys watched with `.watch`. * * Should be called with the same arguments given to `.watch`. * * Returns the array of keys that were unwatched. * * @param keys the keys to unwatch * @param callback the function passed to `.watch` for these keys * @param context the context that was passed to `.watch` for this `callback` */ unwatch(keys: WatchableKey | ReadonlyArray, callback: (model: this, key: WatchableKey, ...args: Array) => unknown, context?: FlowAnyObject | null): Array; /** * @internal */ _onChange(key: WatchableKey, ...args: Array): void; } export default Watchable;