Provides a container for ValueHosts that can be used when working with a model or form. Ultimately in Jivs, it serves the ValueHostsManager, but can work stand-alone. Conditions are passed the ValueHostsManager meaning they can be used independently of validation.

interface IValueHostsManager {
    vh: IValueHostAccessor;
    services: IValueHostsServices;
    dispose(): void;
    getValueHost(valueHostName): null | IValueHost;
    getCalcValueHost(valueHostName): null | ICalcValueHost;
    getStaticValueHost(valueHostName): null | IStaticValueHost;
    enumerateValueHosts(filter?): Generator<IValueHost, any, unknown>;
    addValueHost(config, initialState): IValueHost;
    addOrUpdateValueHost(config, initialState): IValueHost;
    addOrMergeValueHost(config, initialState): IValueHost;
    discardValueHost(valueHostName): void;
    startModifying(): ValueHostsManagerConfigModifier<ValueHostsManagerConfig>;
    notifyOtherValueHostsOfValueChange(valueHostIdThatChanged, revalidate): void;
    notifyValueHostInstanceStateChanged(valueHost, instanceState): void;
}

Hierarchy (view full)

Implemented by

Properties

Alternative to getValueHost() and companion functions that returns strongly typed valuehosts in a shortened syntax. Always throws exceptions if the value host requested is unknown or not the expected type.

Typecast from IServices

Methods

  • If the user needs to abandon this instance, they should use this to clean up active resources (like timers) and to release memory that would stall the garbage collector from disposing this object. It should assign any object reference to undefined as a strong indicator that the object has been disposed.

    Returns void

  • Adds a ValueHostConfig for a ValueHost not previously added. Does not trigger any notifications. Exception when the same ValueHostConfig.name already exists.

    Parameters

    • config: ValueHostConfig

      Can use builder.static(), builder.calc() or any ValueConfigHost. (builder is the Builder API)

    • initialState: null | ValueHostInstanceState

      When not null, this state object is used instead of an initial state. It overrides any state supplied by the ValueHostsManager constructor. It will be run through ValueHostFactory.cleanupInstanceState() first. When null, the state supplied in the ValueHostsManager constructor will be used if available. When neither state was supplied, a default state is created.

    Returns IValueHost

  • Replaces a ValueHostConfig for an already added ValueHost. It does not merge. If merging is required, use addOrMergeValueHost(). Does not trigger any notifications. If the name isn't found, it will be added. Any previous ValueHost and its config will be disposed. Be sure to discard any reference to the ValueHost instance that you have.

    Parameters

    • config: ValueHostConfig

      Can use builder.static(), builder.calc() or any ValueConfigHost. (builder is the Builder API)

    • initialState: null | ValueHostInstanceState

      When not null, this state object is used instead of an initial state. It overrides any state supplied by the ValueHostsManager constructor. It will be run through ValueHostFactory.cleanupInstanceState() first.

    Returns IValueHost

  • Replaces a ValueHostConfig for an already added ValueHost. It merges the new config with the existing one using the ValueHostConfigMergeService. The goal is to protect important business logic settings while allowing the UI to inject new property values where appropriate. Does not trigger any notifications. If the name isn't found, it will be added. Any previous ValueHost and its config will be disposed. Be sure to discard any reference to the ValueHost instance that you have.

    Parameters

    • config: ValueHostConfig

      Can use builder.static(), builder.calc() or any ValueConfigHost. (builder is the Builder API)

    • initialState: null | ValueHostInstanceState

      When not null, this state object is used instead of an initial state. It overrides any state supplied by the ValueHostsManager constructor. It will be run through ValueHostFactory.cleanupInstanceState() first.

    Returns IValueHost

  • Upon changing the value of a ValueHost, other ValueHosts need to know. They may have Conditions that take the changed ValueHost into account and will want to revalidate or set up a state to force revalidation. This goes through those ValueHosts and notifies them.

    Parameters

    • valueHostIdThatChanged: string
    • revalidate: boolean

    Returns void

Generated using TypeDoc v0.25.12