From 96351653168c81c97a92e18bf6ba96eab8a4866b Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Sun, 27 May 2018 16:57:54 +0300 Subject: [PATCH] (Config Service) Added ability to access to the default config and reset to it --- src/@fuse/services/config.service.ts | 29 +++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/@fuse/services/config.service.ts b/src/@fuse/services/config.service.ts index 8f07ee15..e753f337 100644 --- a/src/@fuse/services/config.service.ts +++ b/src/@fuse/services/config.service.ts @@ -59,6 +59,16 @@ export class FuseConfigService return this._configSubject.asObservable(); } + /** + * Get default config + * + * @returns {any} + */ + get defaultConfig(): any + { + return this._defaultConfig; + } + // ----------------------------------------------------------------------------------------------------- // @ Private methods // ----------------------------------------------------------------------------------------------------- @@ -78,11 +88,11 @@ export class FuseConfigService this._defaultConfig.customScrollbars = false; } - // Set the settings from the default settings + // Set the config from the default config this._configSubject = new BehaviorSubject(_.cloneDeep(this._defaultConfig)); - // Reload the default settings on every navigation start if - // the current settings are different from defaults + // Reload the default config on every navigation start if + // the current config is different from the default one this._router.events .pipe(filter(event => event instanceof NavigationStart)) .subscribe(() => { @@ -92,5 +102,18 @@ export class FuseConfigService } }); } + + // ----------------------------------------------------------------------------------------------------- + // @ Public methods + // ----------------------------------------------------------------------------------------------------- + + /** + * Reset to the default config + */ + resetToDefaults(): void + { + // Set the config from the default config + this._configSubject.next(_.cloneDeep(this._defaultConfig)); + } }