• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

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

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了default函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: require

const createLogger = require('redux-logger');
import immutableToJS from '../utils/immutable-to-js';


const logger = createLogger({
  collapsed: true,
  stateTransformer: (state) => {
    return immutableToJS(state);
  },
  predicate: (getState, { type }) => {
    return type !== 'redux-form/BLUR' &&
           type !== 'redux-form/CHANGE' &&
           type !== 'redux-form/FOCUS' &&
           type !== 'redux-form/TOUCH';
  },
});


export default logger;
开发者ID:BrendanFDMoore,项目名称:typescript-react-redux-starter,代码行数:19,代码来源:logger.ts


示例5: createRouterMiddleware

import { applyMiddleware, createStore } from 'redux';
import * as promiseMiddleware from 'redux-promise';
import reducers from 'src/flux/reducers';
import { browserHistory } from 'react-router';
import { routerMiddleware as createRouterMiddleware } from 'react-router-redux';

const routerMiddleware = createRouterMiddleware(browserHistory);
const middleware = [routerMiddleware, promiseMiddleware];

declare const process;
if (process.env.NODE_ENV === 'development') {
  // tslint:disable-next-line:no-var-requires
  const createReduxLogger = require('redux-logger');
  middleware.push(createReduxLogger());
}

const store = createStore(
  reducers,
  applyMiddleware(...middleware),
);

export default store;
开发者ID:OpenChatAlytics,项目名称:OpenChatAlyticsUI,代码行数:22,代码来源:index.ts


示例6: require

import { createStore, applyMiddleware } from 'redux';
import reducers from '../ui/reducers';
let createLogger = require('redux-logger');

let createStoreWithMiddleware =
    (process.env.NODE_ENV === 'development') ? applyMiddleware(createLogger()) : applyMiddleware();
let initialState = window['__INITIAL_STATE__'] ? window['__INITIAL_STATE__'] : createStore(reducers, {});

let store = createStore(
    reducers,
    initialState,
    createStoreWithMiddleware
);

export default store;
开发者ID:cerfuck,项目名称:vse-vzaimosvyazano,代码行数:15,代码来源:index.ts


示例7: require

import { BehaviorSubject } from 'rxjs/BehaviorSubject';

const createSagaMiddleware = require('redux-saga').default;
const reduxRecord = require('redux-simple-test-recorder').default;

let reducers:any = {};

const dummyReducers = function (state:any = {}, action = {}) {
  return state;
};

//noinspection TypeScriptValidateTypes
const sagaMiddleware = createSagaMiddleware();
const devToolsMiddleware = (window as any).devToolsExtension ? (window as any).devToolsExtension() : f => f;
const logger = createLogger();

//noinspection TypeScriptValidateTypes
const record = reduxRecord(TestGenerator);

export const testRecorder = record.recorderInterface;

export const store = createStore(
  dummyReducers,compose(
    applyMiddleware(sagaMiddleware),
    applyMiddleware(record.middleware),
    applyMiddleware(logger),
    devToolsMiddleware
  )
);
开发者ID:e-xtrategy,项目名称:modular-angular2-seed,代码行数:29,代码来源:app.store.ts


示例8: constructor

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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: createLogger

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

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

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


示例14: 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


示例15: 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


示例16: 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


示例17: _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


示例18: 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


示例19: 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


示例20: constructor

  constructor(private ngRedux:NgRedux<RootState>, private logger:Logger,
              private socketService:SocketService) {
    // Logger level
    logger.level = logger.Level.LOG;

    // SocketIO
    socketService.subscribe();
    const windowWrapper:any = window;

    // Redux Store
    let enhancers = [windowWrapper.devToolsExtension ? windowWrapper.devToolsExtension() : f => f];
    this.ngRedux.configureStore(reducer, {} as RootState, [reduxLogger()], enhancers);
  }
开发者ID:dimapod,项目名称:xc-dashboard,代码行数:13,代码来源:app.component.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript redux-mock-store.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript redux-logger.createLogger函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap