/** * Config for web components. */ export default class Config { // Site data base path private _siteDataBasePath: string = "/.k-data"; // Current object id private _currentObject: any = null; // Singleton instance private static singleInstance: Config; // Construct config class constructor() { let windowRef = window; if (windowRef.siteDataBasePath) { this._siteDataBasePath = windowRef.siteDataBasePath; } if (windowRef.currentObject) { this._currentObject = windowRef.currentObject; } } /** * Get the site data base path */ get siteDataBasePath(): string { return this._siteDataBasePath; } /** * Get current object id if set. */ get currentObject(): any { return this._currentObject; } // Return single instance public static instance(): Config { if (!this.singleInstance) { this.singleInstance = new Config(); } return this.singleInstance; } }