當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ngrx-store-logger.storeLogger函數代碼示例

本文整理匯總了TypeScript中ngrx-store-logger.storeLogger函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript storeLogger函數的具體用法?TypeScript storeLogger怎麽用?TypeScript storeLogger使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了storeLogger函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: rootReducer

export function rootReducer (state: AppBackgroundState, action: Action) {
  if (action.type === 'SET_NEW_STATE') {
      state = Object.assign({}, state, action.payload);
  }
  if (!environment.production) {
    return compose(storeLogger(), combineReducers)(appBackgroundState)(state, action);
  } else {
    return compose(combineReducers)(appBackgroundState)(state, action);
  }
}
開發者ID:Le0Michine,項目名稱:Messanger,代碼行數:10,代碼來源:app-background.store.ts

示例2: main

export function main() {
  return bootstrap(AsyncApp, [
      HTTP_PROVIDERS,
      provideStore(
        storeLogger()(combineReducers({selectedReddit, postsByReddit}))
      ),
      runEffects(RedditEffects),
      Reddit
  ])
  .catch(err => console.error(err));
}
開發者ID:ManuCutillas,項目名稱:ngrx-examples,代碼行數:11,代碼來源:bootstrap.ts

示例3: compose

  books: fromBooks.BooksState;
  cubes: fromCubes.CubesState;
  collection: fromCollection.CollectionState;
  cube_collection: fromCubesCollection.CollectionState;
  tree: fromTree.TreesState
}


/**
 * Because metareducers take a reducer function and return a new reducer,
 * we can use our compose helper to chain them together. Here we are
 * using combineReducers to make our top level reducer, and then
 * wrapping that in storeLogger. Remember that compose applies
 * the result from right to left.
 */
export default compose(storeLogger(), combineReducers)({
  router: routerReducer,
  search: searchReducer,
  cubes_search: cubes_searchReducer,
  books: booksReducer,
  cubes: cubesReducer,
  collection: collectionReducer,
  cube_collection: cubes_collectionReducer,
  tree: tree_Reducer
});


/**
 * A selector function is a map function factory. We pass it parameters and it
 * returns a function that maps from the larger state tree into a smaller
 * piece of state. This selector simply selects the `books` state.
開發者ID:mlukasch,項目名稱:indigo,代碼行數:31,代碼來源:index.ts

示例4: stateSetter

import { storeFreeze } from 'ngrx-store-freeze';
import { storeLogger } from 'ngrx-store-logger';
import { reducers } from './root';

export { reducers, AppState } from './root';

declare const ENV: string;

// Generate a reducer to set the root state in dev mode for HMR
function stateSetter(reducer: ActionReducer<any>): ActionReducer<any> {
  return function(state, action) {
    if (action.type === 'SET_ROOT_STATE') {
      return action.payload;
    }
    return reducer(state, action);
  };
}

const DEV_REDUCERS = [stateSetter, storeFreeze, storeLogger()];

const developmentReducer = compose(...DEV_REDUCERS, combineReducers)(reducers);
const productionReducer = compose(combineReducers)(reducers);

export function rootReducer(state: any, action: any) {
  if (ENV !== 'development') {
    return productionReducer(state, action);
  } else {
    return developmentReducer(state, action);
  }
}
開發者ID:greg9504,項目名稱:angular-electron-dream-starter,代碼行數:30,代碼來源:index.ts

示例5: compose

import { compose } from '@ngrx/core/compose';
import { storeLogger } from 'ngrx-store-logger';
import { combineReducers } from '@ngrx/store';
import { itemReducer } from './item/item.reducer';

export const appReducer = compose(storeLogger(), combineReducers)({
  item: itemReducer,
});
開發者ID:penmark,項目名稱:mediat-frontend,代碼行數:8,代碼來源:app.reducer.ts

示例6: compose

import { storeLogger } from 'ngrx-store-logger';
import { localStorageSync } from 'ngrx-store-localstorage';

import { IState as ICounterState, reducer as counterReducer } from './counter';
import { IState as IUserState, reducer as userReducer } from './user';
import { IState as IConfigState, reducer as configReducer } from './config';

// application state interface
export interface IState {
  router: RouterState;
  config: IConfigState;
  counter: ICounterState;
  user: IUserState;
}

// app level reducers
export const reducers = {
  router: routerReducer,
  config: configReducer,
  counter: counterReducer,
  user: userReducer
};

// root reducer
export const reducer: ActionReducer<IState> = compose(
  storeLogger(),
  storeFreeze,
  localStorageSync(keys(reducers), true),
  combineReducers
)(reducers);
開發者ID:lunches-platform,項目名稱:fe,代碼行數:30,代碼來源:app.reducer.ts

示例7: compose

  auth: AuthState;
  schedules: ScheduleState;
  speakers: SpeakerState;
  map: MapState;
}

/**
 * Because metareducers take a reducer function and return a new reducer,
 * we can use our compose helper to chain them together. Here we are
 * using combineReducers to make our top level reducer, and then
 * wrapping that in storeLogger. Remember that compose applies
 * the result from right to left.
 */
const reducers = {
  map: mapReducer,
  speakers: speakerReducer,
  schedules: scheduleReducer,
  auth: authReducer
};

const developmentReducer = compose(storeFreeze, storeLogger(), combineReducers)(reducers);
const productionReducer = combineReducers(reducers);

export function reducer(state: any, action: any) {
  if (process.env.NODE_ENV === 'production') {
    return productionReducer(state, action);
  } else {
    return developmentReducer(state, action);
  }
}
開發者ID:ddellamico,項目名稱:ionic-conference-app,代碼行數:30,代碼來源:index.ts

示例8: logger

export function logger(_reducer: ActionReducer<any>): any {
  return storeLogger()(_reducer);
}
開發者ID:garlictech,項目名稱:generator-garlic-webapp,代碼行數:3,代碼來源:index.ts

示例9: compose

// Re export symbol for commodity
export { Store, Action, State } from '@ngrx/store';


import { REDUCERS as PROJECTS_REDUCER } from './projects.reducer';

var REDUCERS = Object.assign({}, PROJECTS_REDUCER);

export var PROVIDERS: Array<any> = [];

const initialState = {

}

import { StoreModule, combineReducers } from '@ngrx/store';
import { compose } from '@ngrx/core';
import { storeLogger } from 'ngrx-store-logger';

export const MODULE =
    StoreModule.provideStore(
        compose(
            storeLogger({ collapsed: true }),
            combineReducers
        )(REDUCERS), 
        initialState);
開發者ID:ClementVidal,項目名稱:infra.starter.themba,代碼行數:25,代碼來源:index.ts

示例10: logger

export function logger(reducer: ActionReducer<State>): any {
  return storeLogger({
    collapsed: true
  })(reducer);
}
開發者ID:atSistemas,項目名稱:angular-base,代碼行數:5,代碼來源:index.ts


注:本文中的ngrx-store-logger.storeLogger函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。