import { Model } from './Model'; import { ModelClient } from './ModelClient'; import { ModelStore } from './ModelStore'; export interface ModelManagerConfiguration { forceReload?: boolean; model?: Model; modelClient?: ModelClient; path?: string; } export declare type ListenerFunction = () => void; export declare class ModelManager { private _modelClient; private _modelStore; private _listenersMap; private _fetchPromises; private _initPromise; private _editorClient; get modelClient(): ModelClient; get modelStore(): ModelStore; /** * Initializes the ModelManager using the given path to resolve a data model. * If no path is provided, fallbacks are applied in the following order: * * - meta property: cq:pagemodel_root_url * - current pathname of the browser * * Once the initial model is loaded and if the data model doesn't contain the path of the current pathname, the library attempts to fetch a fragment of model. * * @param {string|InitializationConfig} [config] - URL to the data model or configuration object * @fires cq-pagemodel-loaded * @return {Promise} */ initialize(config?: ModelManagerConfiguration | string): Promise; /** * Returns the path of the data model root. * * @return {string} */ get rootPath(): string; /** * Returns the model for the given configuration * @param {string|GetDataConfig} [config] - Either the path of the data model or a configuration object. If no parameter is provided the complete model is returned * @return {Promise} */ getData(config?: ModelManagerConfiguration | string): Promise; /** * Fetches a model for the given path * * @param {string} path - Model path * @return {Promise} * @private */ _fetchData(path: string): Promise; /** * Notifies the listeners for a given path * * @param {string} path - Path of the data model * @private */ _notifyListeners(path: string): void; /** * Add the given callback as a listener for changes at the given path. * * @param {String} [path] Absolute path of the resource (e.g., "/content/mypage"). If not provided, the root page path is used. * @param {String} [callback] Function to be executed listening to changes at given path */ addListener(path: string | undefined, callback: ListenerFunction): void; /** * Remove the callback listener from the given path path. * * @param {String} [path] Absolute path of the resource (e.g., "/content/mypage"). If not provided, the root page path is used. * @param {String} [callback] Listener function to be removed. */ removeListener(path: string | undefined, callback: ListenerFunction): void; /** * Adapts the provided path to a valid model path. * Returns an empty string if the given path is equal to the root model path. * This function is a utility tool that converts a provided root model path into an internal specific empty path * * @param {string} [path] - raw model path * @return {string} the valid model path * * @private */ adaptPagePath(path: string): string; /** * @private */ private destroy; private _storeData; /** * Transforms the given path into a model URL * * @param path * @return {*} * @private */ private _toModelPath; /** * Verifies the integrity of the provided dependencies * * @return {Promise} * @private */ private _checkDependencies; } declare const _default: ModelManager; export default _default; //# sourceMappingURL=ModelManager.d.ts.map