From e0b05f444347bf9d85271c31e323d6959d2ffa8e Mon Sep 17 00:00:00 2001 From: roopkt Date: Sat, 21 Oct 2017 09:01:32 -0400 Subject: [PATCH] adding support for name in storedevtools #463 --- modules/store-devtools/spec/config.spec.ts | 17 +++-------------- modules/store-devtools/src/config.ts | 3 +-- modules/store-devtools/src/instrument.ts | 11 ++--------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/modules/store-devtools/spec/config.spec.ts b/modules/store-devtools/spec/config.spec.ts index a730dd007f..80645df646 100644 --- a/modules/store-devtools/spec/config.spec.ts +++ b/modules/store-devtools/spec/config.spec.ts @@ -2,20 +2,9 @@ import { ActionReducer, Action } from '@ngrx/store'; import { StoreDevtoolsConfig } from '../'; describe('StoreDevtoolsOptions', () => { - it('can be initialized with actionSanitizer', () => { + it('can be initialized with name', () => { const options = new StoreDevtoolsConfig(); - function sanitizer(action: Action, id: number): Action { - return action; - } - options.actionSanitizer = sanitizer; - expect(options.actionSanitizer).toEqual(sanitizer); - }); - it('can be initialized with stateSanitizer', () => { - const options = new StoreDevtoolsConfig(); - function stateSanitizer(state: any, index: number): any { - return state; - } - options.actionSanitizer = stateSanitizer; - expect(options.actionSanitizer).toEqual(stateSanitizer); + options.name = 'my instance'; + expect(options.name).toBe('my instance'); }); }); diff --git a/modules/store-devtools/src/config.ts b/modules/store-devtools/src/config.ts index d31c2adf8e..07cfeb967c 100644 --- a/modules/store-devtools/src/config.ts +++ b/modules/store-devtools/src/config.ts @@ -4,8 +4,7 @@ import { InjectionToken, Type } from '@angular/core'; export class StoreDevtoolsConfig { maxAge: number | false; monitor: ActionReducer; - actionSanitizer?: (action: A, id: number) => A; - stateSanitizer?: (state: S, index: number) => S; + name: string; } export const STORE_DEVTOOLS_CONFIG = new InjectionToken( diff --git a/modules/store-devtools/src/instrument.ts b/modules/store-devtools/src/instrument.ts index 56be93202c..d791f9ae3b 100644 --- a/modules/store-devtools/src/instrument.ts +++ b/modules/store-devtools/src/instrument.ts @@ -64,13 +64,7 @@ export function noMonitor(): null { return null; } -export function noActionSanitizer(): null { - return null; -} - -export function noStateSanitizer(): null { - return null; -} +export const DEFAULT_NAME = 'store-devtool-instance'; export function createConfig( _options: StoreDevtoolsOptions @@ -78,8 +72,7 @@ export function createConfig( const DEFAULT_OPTIONS: StoreDevtoolsConfig = { maxAge: false, monitor: noMonitor, - actionSanitizer: noActionSanitizer, - stateSanitizer: noStateSanitizer, + name: DEFAULT_NAME, }; let options = typeof _options === 'function' ? _options() : _options;