本文整理汇总了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, []);
}
示例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);
};
示例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;
示例4: constructor
constructor(private ngRedux: NgRedux<any>) {
this.ngRedux.configureStore(rootReducer,
{}, // Inital State
[
reduxLogger()
]);
}
示例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;
}
示例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;
}
示例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;
};
示例8: constructor
constructor(
private ngRedux: NgRedux<IAppState>,
private devTool: DevToolsExtension) {
this.ngRedux.configureStore(
rootReducer,
{},
[ createLogger() ],
[ ...enhancers, devTool.isEnabled() ? devTool.enhancer() : f => f]);
}
示例9: createLogger
($ngReduxProvider) => {
const logger = createLogger();
let middleware = [thunk];
if (__DEV__) {
middleware.push(logger);
}
$ngReduxProvider.createStoreWith(rootReducer, middleware);
}
示例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]);
}
示例11: constructor
constructor(private ngRedux: NgRedux<RootState>) {
// Do this once in the top-level app component.
this.ngRedux.configureStore(
reducer,
{ counter: 0 },
[ createLogger() ],
enhancers
);
}
示例12: configure
configure(ngRedux: NgRedux<IAppState>): void {
ngRedux.configureStore(
rootReducer,
{},
[ createLogger() ],
[
...enhancers,
this.devTool.isEnabled() ? this.devTool.enhancer() : f => f
]
);
}
示例13: _getMiddleware
function _getMiddleware() {
let middleware = [
thunk
];
if (__DEV__) {
const logger = createLogger();
middleware = [ ...middleware, logger ];
}
return middleware;
}
示例14: constructor
constructor(
ngRedux: NgRedux<RootState>,
ngReduxRouter: NgReduxRouter
) {
ngRedux.configureStore(
reducer,
{ counter: 0 },
[ createLogger() ],
enhancers
);
ngReduxRouter.initialize();
}
示例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);
}