import { DynamicProperties as DP } from './properties/dynamicProperties'; import { IDynamicProperty } from './dynamicProperty'; import { ConfigurationSourceBuilder } from './configurationSources/configurationSourceBuilder'; /** * * Provides dynamic properties updated when config change. * Accessing a dynamic property is very fast. The last value is cached and updated on the fly * from a ConfigurationSource at fixed interval. * Updates are made using polling requests on a list of sources. *

* Dynamic properties are read only. You can set a value but it will be valid only as a default value. *

* * DynamicConfiguration.init().addRest("http....").startPollingAsync(); * let i:number = DynamicConfiguration.getProperty("prop1"); * let i2:number = DynamicConfiguration.getOrDefaultProperty("prop1", 1); * */ export declare class DynamicConfiguration { /** * subscribe on a property changed */ static onPropertyChanged(handler: (e: IDynamicProperty) => void, propertyName?: string): void; /** * Create a chained property * */ static asChainedProperty(defaultValue: T, name: string, ...fallbackPropertyNames: Array): IDynamicProperty; /** * Create a new property */ static asProperty(value: T, name?: string, onPropertyChanged?: (e: IDynamicProperty) => void): IDynamicProperty; /** * Get a property value by name * * @static * @template T * @param {string} name * @returns * * @memberOf DynamicConfiguration */ static get(name: string): any; /** * Get a dynamic property */ static getProperty(name: string): IDynamicProperty; /** * Get or create a dynamic property * defaultValue can be a value or a factory */ static getOrCreateProperty(name: string, defaultValue: T): IDynamicProperty; /** * Update a property value or create a new one if not exists */ static setOrCreateProperty(name: string, defaultValue: () => IDynamicProperty | T): IDynamicProperty; /** * Init polling informations. This function can be call only once before any use of a dynamic property. */ static init(pollingIntervalInSeconds?: number, sourceTimeoutInMs?: number): ConfigurationSourceBuilder; static reset(pollingIntervalInSeconds?: number, sourceTimeoutInMs?: number): void; /** * Get the underlying dynamic properties manager instance */ static instance: DP; }