import { Undefinable } from "../Types"; import { IModelState } from "./IModelState"; export default abstract class BaseModelState implements IModelState { #private; constructor(value?: T); /** * Creates a subscription to the ModelState that will be called when * the state is updated. * * @param callback The callback to be invoked when the state is updated * @returns A symbol that must saved to unsubscribe from the ModelState */ subscribe(postCallback: (value: Undefinable) => void, preCallback?: (value: Undefinable) => void): string; /** * Unsubscribes a component from the model state. * * @param key The symbol that was returned from the subscribe method. */ unsubscribe(key: string): void; /** Gets the current value of the ModelState */ get value(): Undefinable; /** Returns the current value of the ModelState */ valueOf(): Undefinable; /** Returns the string version of the ModelState value */ toString(): string; /** Returns the ModelState as a Promise */ toPromise(): Promise>; protected subscribeCore(postCallback: (value: Undefinable) => void, preCallback?: (value: Undefinable) => void, publishCurrentValue?: boolean): string; protected getValue(): Undefinable; protected setValue(value: Undefinable): void; }