Hosanna UI API v2.3.0-next
    Preparing search index...

    The IAppConfig interface provides access to application configuration data loaded from app.config.json files. These configuration files are used by Hosanna UI apps to control styling, text, services, and behavior settings. Configurations can be loaded from local files or remote services, allowing for dynamic app customization and theming without requiring code changes.

    The interface supports:

    • Hierarchical style inheritance and resolution
    • Dynamic data binding with ${data.key} syntax
    • Internationalization and locale management
    • Style merging and caching for performance
    interface IAppConfig {
        configure(): void;
        get<T = IStyle>(key: string): undefined | T;
        get<T>(key: string, defaultValue: T): T;
        getLocale(): string;
        getReadingDirection(): ReadingDirection;
        getResolvedStyleGeneration(key: string): number;
        getStyleLayoutRevision(): number;
        invalidateCacheForBranch(key: string): void;
        isLoaded(): boolean;
        resetCache(): void;
        resolveRowStyle(row: ICollectionViewDataSourceRow): IOperationResult;
        set(key: string, config: IStyle, merge?: boolean): void;
        setConfig(json: { [key: string]: IStyle }): void;
        setLocale(languageCode: string, sectionKey?: string): void;
        subscribeLocaleChanges(handler: LocaleChangeHandler): number;
        translate(key: string): string;
        unsubscribeLocaleChanges(subscriptionId: number): void;
        updateBranch(
            key: string,
            config: IStyle,
            options?: { invalidateCache?: boolean; merge?: boolean },
        ): void;
    }

    Implemented by

    Index

    Methods

    • Configures the app config, setting up necessary resolution information. This method is called by the framework to initialize the config with device-specific settings.

      Returns void

    • Retrieves a configuration by its key, resolving nested references as needed.

      Type Parameters

      Parameters

      • key: string

        The key for the configuration to retrieve.

      Returns undefined | T

      The resolved configuration.

    • Type Parameters

      • T

      Parameters

      • key: string
      • defaultValue: T

      Returns T

    • Returns the active BCP-47 language tag.

      Returns string

    • Returns the physical reading direction resolved for the active locale.

      Returns ReadingDirection

    • Returns the generation of the resolved style currently cached at key. A newly resolved style receives a new generation even when a targeted invalidation does not advance the global layout revision.

      Parameters

      • key: string

      Returns number

    • Monotonic epoch bumped whenever resolved styles or constraint layout validity may change (setConfig, set, resetCache). Included in fragment constraint layout cache keys.

      Returns number

    • Invalidates cached resolved styles for a branch and its descendants without clearing unrelated resolved-style cache entries.

      Parameters

      • key: string

      Returns void

    • Indicates whether setConfig(...) has been called with app configuration data.

      Returns boolean

    • Clears resolved-style cache and process-local fragment constraint layout cache (clearFragmentConstraintLayoutCache from FragmentConstraintLayoutCache.ts), so constraint replay keys cannot outlive style reloads.

      Returns void

    • Sets a single configuration entry in the registry, with an option to merge with existing configurations.

      Parameters

      • key: string

        The unique identifier for the configuration.

      • config: IStyle

        The configuration data to be set.

      • Optionalmerge: boolean

        If true, merges with an existing configuration.

      Returns void

    • Sets the initial JSON with all configuration, clearing any cached configurations.

      Parameters

      • json: { [key: string]: IStyle }

        The JSON containing all configuration.

      Returns void

    • Sets the current language/locale for translations.

      Parameters

      • languageCode: string

        The language code to set.

      • OptionalsectionKey: string

        The section key for translations (optional).

      Returns void

    • Subscribes to successful locale changes and returns a removable subscription id.

      Parameters

      • handler: LocaleChangeHandler

      Returns number

    • Gets a translation for the given key.

      Parameters

      • key: string

        The translation key.

      Returns string

      The translated string.

    • Removes a locale-change subscription.

      Parameters

      • subscriptionId: number

      Returns void

    • Updates a single branch inside the configuration tree and invalidates cached resolved styles for that branch only.

      Parameters

      • key: string
      • config: IStyle
      • Optionaloptions: { invalidateCache?: boolean; merge?: boolean }

      Returns void