本文整理匯總了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);
}