import { AppConfig } from "@geocortex/api/AppConfig"; import { AppContainer } from "@geocortex/api/AppContainer"; import { Observable } from "@geocortex/api/support/Observable"; import { LogLevel } from "@geocortex/api/utilities/log"; import { LibraryRegistry } from "./config"; import { Layout } from "./layout"; import { Action } from "./messaging"; import { InjectionContainer } from "./services"; import { UIService } from "./ui"; /** A URL to an App config document. */ export declare type AppConfigUrl = string; /** A URL to a layout XML document. */ export declare type LayoutUrl = string; /** A layout XML document. */ export declare type LayoutXml = string; export declare type Library = (registry: LibraryRegistry) => void; /** * Options used to initialize {@link Application}. */ export interface ApplicationOptions { /** * The Geocortex App configuration to load. Can either be an AppConfig * object or a URL to an App JSON file. */ appConfig?: AppConfigUrl | AppConfig; /** * This determines how relative URLs within the App are interpreted. Not * needed if appConfig is a URL. */ appConfigBaseUrl?: string; /** * Whether the application is running the default application or is in designer */ defaultApp?: boolean; /** * The layout to use when none are defined in the App and "layout" isn't * specified. Can either be layout XML or a URL to a layout document. */ defaultLayout?: LayoutUrl | LayoutXml; debugMode?: boolean; /** * Optionally specify the log verbosity to use for logging */ logLevel?: LogLevel; hostElement?: HTMLElement; /** * If the viewer is embedded in an HTML page. Behaviors, including map * controls, are impacted by this setting. */ isEmbedded?: boolean; /** * The layout to use. Can either be layout XML or a URL to a layout * document. If specified, it will override any layouts defined in the App. */ layout?: LayoutUrl | LayoutXml; /** * Additional configuration libraries that will be registered with the * application. */ libraries?: Library[]; /** * The locale to use. If not explicitly specified, it will be detected * automatically. */ locale?: string; /** * Optionally an Action to be run at startup */ startUpAction?: Action; } export declare class Application extends Observable { /** * The options used to initialize the application. */ readonly options: ApplicationOptions; /** * The dependency injection container used by the application. Callers can * manually add or update services prior to initializing the application. */ readonly injectionContainer: InjectionContainer; ui: UIService; private readonly _messages; private readonly _libraries; private _appState; private _isInitialized; private _isDestroyed; private _initializePromise; private _destroyPromise; constructor(options?: ApplicationOptions); /** * Determines whether the application is initialized. */ get isInitialized(): boolean; get isDestroyed(): boolean; /** * An AppContainer representing the current state of the application. */ get appState(): AppContainer; /** * Initializes the application. */ initialize(): Promise; destroy(): Promise; /** * Invoked by {@link initialize} to perform initialization. */ protected _onInitialize(): Promise; protected _onDestroy(): Promise; /** * Chooses a layout from the app state. * @param appState The app state possibly containing layouts. */ protected _getLayoutFromApp(appState: AppContainer): Promise; private _initializeApplicationHooks; private _initializeCustomLibraries; private _selectInitialLayout; private _createAppState; private _ensureNotDestroyed; private _registerAppStateFactory; }