当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript redux-logger.default函数代码示例

本文整理汇总了TypeScript中redux-logger.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createStore

export default function createStore($ngReduxProvider: INgReduxProvider):void {
    const logger = createLogger({
        predicate: (getState: any, action: Action) => {
            switch(action.type) {
                case '@@reduxUiRouter/$stateChangeStart':
                case '@@reduxUiRouter/$stateChangeSuccess':
                    if(cfg.showRouteLogging) {
                        return false;
                    }
            }
            return true;
        },
    });

    let middleWare: any[] = ['ngUiRouterMiddleware', thunk];
    if(cfg.enabled) {
        middleWare.push(logger);
    }

    $ngReduxProvider.createStoreWith(rootReducer, middleWare, []);
}
开发者ID:ericlink,项目名称:ts-angular-redux-seed,代码行数:21,代码来源:store.ts

示例2: require

import reducer from '../reducers/index';
import remoteAction from '../middleware/remote-action';
import { createStore, applyMiddleware } from 'redux';
import routerMiddleware from '../router-redux/middleware';

// const persistState = require('redux-localstorage');
const createLogger = require('redux-logger');
const thunk = require('redux-thunk').default;
const loggerMiddleware = createLogger({collapsed: true});

export default function configureStore(initialState, history) {
  const router = routerMiddleware(history);
  const createStoreWithMiddleware = applyMiddleware(
    thunk,
    remoteAction,
    router,
    loggerMiddleware
  )(createStore);

  return createStoreWithMiddleware(reducer, initialState);
};
开发者ID:levinmr,项目名称:angular2-webpack-redux,代码行数:21,代码来源:configure-store-dev.ts

示例3: require

declare let __DEV__: any;
import {Iterable} from 'immutable';
const createLogger = require('redux-logger');

const logger = createLogger({
    level: 'info',
    collapsed: true,
    predicate: (getState, action) => __DEV__ === true,
    stateTransformer: (state) => {
        let newState = {};
        for (let i of Object.keys(state)) {
            if (Iterable.isIterable(state[i])) {
                newState[i] = state[i].toJS();
            } else {
                newState[i] = state[i];
            }
        };
        return newState;
    }
});

export default logger;
开发者ID:AbdellaToronto,项目名称:angular2-redux-starter,代码行数:22,代码来源:configure-logger.ts

示例4: constructor

 constructor(private ngRedux: NgRedux<any>) {
     this.ngRedux.configureStore(rootReducer,
         {}, // Inital State
         [
             reduxLogger()
         ]);
 }
开发者ID:hieuvoquang87,项目名称:ionic2-redux-yelp-replica,代码行数:7,代码来源:configure-store.ts

示例5: configureStore

export function configureStore(history, initialState?: IStore): Redux.Store<IStore> {

  const middlewares: Redux.Middleware[] = [
    routerMiddleware(history),
    thunk,
  ];

  /** Add Only Dev. Middlewares */
  if (appConfig.env !== 'production' && process.env.BROWSER) {
    const logger = createLogger();
    middlewares.push(logger);
  }

  const composeEnhancers = (appConfig.env !== 'production' &&
    typeof window === 'object' &&
    window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) || compose;

  const store = createStore(rootReducer, initialState, composeEnhancers(
    applyMiddleware(...middlewares),
  ));

  if (appConfig.env === 'development' && (module as any).hot) {
    (module as any).hot.accept('./reducers', () => {
      store.replaceReducer((require('./reducers')));
    });
  }

  return store;
}
开发者ID:barbar,项目名称:vortigern,代码行数:29,代码来源:store.ts

示例6: configureStore

export function configureStore(history, initialState?: any): Redux.Store {

  let middlewares: any[] = [
    routerMiddleware(history),
    thunk
  ];

  /** Add Only Dev. Middlewares */
  if (appConfig.env !== 'production' && process.env.BROWSER) {
    const logger = createLogger();
    middlewares.push(logger);
  }

  const enhancer = compose(
    applyMiddleware(...middlewares),
    appConfig.env === 'development' &&
    typeof window === 'object' &&
    typeof window.devToolsExtension !== 'undefined'
      ? window.devToolsExtension() : f => f
  );

  const store: Redux.Store = createStore(rootReducer, initialState, enhancer);

  if (appConfig.env === 'development' && (module as any).hot) {
    (module as any).hot.accept('./reducers', () => {
      store.replaceReducer((require('./reducers')));
    });
  }

  return store;
}
开发者ID:basicsharp,项目名称:vortigern,代码行数:31,代码来源:store.ts

示例7: configureStore

export function configureStore(initialState?: any): Redux.Store {

	let middlewares = [router, thunk];

	if (appConfig.env === 'development') {
		const logger = createLogger();
		middlewares.push(logger);
	}

	const finalCreateStore = compose(
		applyMiddleware(...middlewares),
		appConfig.env === 'development' && typeof window === 'object' 
		&& typeof window.devToolsExtension !== 'undefined' 
		? window.devToolsExtension() : DevTools.instrument()
	)(createStore);

	const store: Redux.Store = finalCreateStore(rootReducer, initialState);

	if (appConfig.env === 'development' && (module as any).hot) {
		(module as any).hot.accept('./reducers', () => {
			store.replaceReducer((require('./reducers')));
		});
	}

	return store;
};
开发者ID:crudbug,项目名称:vortigern,代码行数:26,代码来源:store.ts

示例8: constructor

  constructor(
    private ngRedux: NgRedux<IAppState>,
    private devTool: DevToolsExtension) {

    this.ngRedux.configureStore(
      rootReducer,
      {},
      [ createLogger() ],
      [ ...enhancers, devTool.isEnabled() ? devTool.enhancer() : f => f]);
  }
开发者ID:e-xtrategy,项目名称:ng2-redux,代码行数:10,代码来源:app.component.ts

示例9: createLogger

    ($ngReduxProvider) => {
      const logger = createLogger();
      let middleware = [thunk];

      if (__DEV__) {
        middleware.push(logger);
      }

      $ngReduxProvider.createStoreWith(rootReducer, middleware);
    }
开发者ID:alanthai,项目名称:Blantons-Search,代码行数:10,代码来源:index.ts

示例10: constructor

 constructor(
   private ngRedux: NgRedux<IAppState>,
   private devTool: DevToolsExtension) {
   // Do this once in the top-level app component.
   this.ngRedux.configureStore(
     rootReducer,
     {},
     [ createLogger() ],
     [ ...enhancers, devTool.isEnabled() ? devTool.enhancer() : f => f]);
 }
开发者ID:9590,项目名称:ng2-redux,代码行数:10,代码来源:app.component.ts

示例11: constructor

    constructor(private ngRedux: NgRedux<RootState>) {

        // Do this once in the top-level app component.
        this.ngRedux.configureStore(
            reducer,
            { counter: 0 },
            [ createLogger() ],
            enhancers
        );

    }
开发者ID:echalkpad,项目名称:ng2-redux,代码行数:11,代码来源:App.ts

示例12: configure

 configure(ngRedux: NgRedux<IAppState>): void {
   ngRedux.configureStore(
     rootReducer,
     {},
     [ createLogger() ],
     [
       ...enhancers,
       this.devTool.isEnabled() ? this.devTool.enhancer() : f => f
     ]
   );
 }
开发者ID:microwave-taco,项目名称:taco-tuts,代码行数:11,代码来源:configure-store.service.ts

示例13: _getMiddleware

function _getMiddleware() {
  let middleware = [
    thunk
  ];

  if (__DEV__) {
    const logger = createLogger();
    middleware = [ ...middleware, logger ];
  }

  return middleware;
}
开发者ID:alanthai,项目名称:angular-redux-starter,代码行数:12,代码来源:configure-store.ts

示例14: constructor

 constructor(
   ngRedux: NgRedux<RootState>,
   ngReduxRouter: NgReduxRouter
 ) {
   ngRedux.configureStore(
       reducer,
       { counter: 0 },
       [ createLogger() ],
       enhancers
   );
   ngReduxRouter.initialize();
 }
开发者ID:dagstuan,项目名称:ng2-redux-router,代码行数:12,代码来源:app.module.ts

示例15: constructor

 constructor(
   private ngRedux: NgRedux<any>,
   private devTool: DevToolsExtension) {
   // Do this once in the top-level app component.
   this.ngRedux.configureStore(
     reducer,
     {},
     [ createLogger() ],
     devTool.isEnabled() ?
     [ ...enhancers, devTool.enhancer() ] :
     enhancers);
   }
开发者ID:EthanK28,项目名称:ng2-redux,代码行数:12,代码来源:app.component.ts


注:本文中的redux-logger.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。