import { IngestConfigInterface, Observer, ObserverKey, SubscriptionContainer } from '../runtime'; import { CreateStateRuntimeJobConfigInterface, StateRuntimeJob } from './state.runtime.job'; import { State } from './state'; export declare class StateObserver extends Observer { state: () => State; nextStateValue: ValueType; /** * A State Observer manages the subscriptions to Subscription Containers (UI-Components) * and dependencies to other Observers (Agile Classes) * for a State Class. * * @internal * @param state - Instance of State the Observer belongs to. * @param config - Configuration object */ constructor(state: State, config?: CreateStateObserverConfigInterface); /** * Passes the State Observer into the runtime wrapped into a Runtime-Job * where it is executed accordingly. * * During the execution the runtime applies the `nextStateValue` * or the `computedValue` (Computed Class) to the State, * updates its dependents and re-renders the UI-Components it is subscribed to. * * @internal * @param config - Configuration object */ ingest(config?: StateIngestConfigInterface): void; /** * Passes the State Observer into the runtime wrapped into a Runtime-Job * where it is executed accordingly. * * During the execution the runtime applies the specified `newStateValue` to the State, * updates its dependents and re-renders the UI-Components it is subscribed to. * * @internal * @param newStateValue - New value to be applied to the State. * @param config - Configuration object. */ ingestValue(newStateValue: ValueType, config?: StateIngestConfigInterface): void; /** * Method executed by the Runtime to perform the Runtime-Job, * previously ingested via the `ingest()` or `ingestValue()` method. * * Thereby the previously defined `nextStateValue` is assigned to the State. * Also side effects (like calling watcher callbacks) of a State change are executed. * * @internal * @param job - Runtime-Job to be performed. */ perform(job: StateRuntimeJob): void; /** * Performs the side effects of applying the next State value to the State. * * Side effects are, for example, calling the watcher callbacks * or executing the side effects defined in the State Class * like 'rebuildGroup' or 'rebuildStateStorageValue'. * * @internal * @param job - Job that is currently performed. */ sideEffects(job: StateRuntimeJob): void; } export interface CreateStateObserverConfigInterface { /** * Initial Observers to depend on the Observer. * @default [] */ dependents?: Array; /** * Initial Subscription Containers the Observer is subscribed to. * @default [] */ subs?: Array; /** * Key/Name identifier of the Observer. * @default undefined */ key?: ObserverKey; } export interface StateIngestConfigInterface extends CreateStateRuntimeJobConfigInterface, IngestConfigInterface { }