SHARE
TWEET

Untitled

a guest Jul 18th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Action, ActionReducer, MetaReducer } from '@ngrx/store';
  2. import { environment } from 'src/environments/environment';
  3. import { storeFreeze } from 'ngrx-store-freeze';
  4.  
  5. export function debugMetaReducer(
  6.   reducer: ActionReducer<object>
  7. ): ActionReducer<object> {
  8.   return function(oldState: object, action: Action): object {
  9.     const newState = reducer(oldState, action);
  10.     console.groupCollapsed(
  11.       `%c NgRx store update by '${action.type}'`,
  12.       'color: #e2001a'
  13.     );
  14.     console.log('Old state: ', oldState);
  15.     console.log('Action: ', action);
  16.     console.log('New state: ', newState);
  17.     console.groupEnd();
  18.  
  19.     return newState;
  20.   };
  21. }
  22.  
  23. export const metaReducers: MetaReducer<any>[] = [debugMetaReducer, storeFreeze];
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top