當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。