Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// if (type.startsWith('ReadoutCntlr')) return false;
// return window.enableFireflyReduxLogging;
// }
function logFilter(getState,action) {
return window.enableFireflyReduxLogging;
}
function collapsedFilter(getState,action) {
return collapsedLogging.includes(action.type);
}
// eslint-disable-next-line
const logger= createLogger({duration:true, predicate:logFilter, collapsed:collapsedFilter}); // developer can add for debugging
function createRedux() {
// create a rootReducer from all of the registered reducers
const rootReducer = combineReducers(reducers);
const sagaMiddleware = createSagaMiddleware();
const middleWare= applyMiddleware(thunkMiddleware, logger, sagaMiddleware); //todo: turn off action logging
const store = createStore(rootReducer, middleWare);
sagaMiddleware.run(masterSaga);
return store;
}
function startCoreSagas() {
dispatchAddSaga( imagePlotter);
dispatchAddSaga( watchReadout);
dispatchAddSaga( watchForRelatedActions);
// @flow
import { createLogger } from 'redux-logger';
const blacklist = [
// If you wish to remove actions from the
// logger, they should be added here
];
const Logger = createLogger({
predicate: (getState, action) => !blacklist.includes(action.type)
});
module.exports = Logger;
import { createStore, applyMiddleware, compose } from 'redux';
import { createLogger } from 'redux-logger';
import createSagaMiddleware, { END } from 'redux-saga';
import rootReducer from '../reducers';
import config from '../config';
const logger = createLogger({
level: 'info',
collapsed: true,
});
/* eslint-disable no-underscore-dangle */
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
/* eslint-enable */
export default function configureStore(initialState) {
const sagaMiddleware = createSagaMiddleware();
const middlewares = [
sagaMiddleware,
config.reduxLogger && logger,
].filter(Boolean);
const enhancer = composeEnhancers(
AppRegistry,
} from 'react-native';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, combineReducers, compose} from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger } from 'redux-logger';
import reducers from './app/reducers'
import AppContainer from './app/containers/AppContainer'
//Redux Storage imports. AsyncStorage is the Storage Engine
import {persistStore, autoRehydrate} from 'redux-persist'
import {AsyncStorage} from 'react-native'
//define logger middleware: set logger for only development mode
const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ });
function configureStore(initialState) {
//more boilerplate. Enhancer composes different middleware
const enhancer = compose(
autoRehydrate(),
applyMiddleware(
thunkMiddleware,
loggerMiddleware,
),
);
return createStore(reducers, initialState, enhancer);
}
const store = configureStore({});
/* Enable PersistStore by uncommenting below */
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import { persistStore, autoRehydrate } from 'redux-persist'
import {createLogger} from 'redux-logger';
import thunk from 'redux-thunk';
import todoReducer from './reducers/todo-reducers';
// import storage from 'redux-persist/lib/storage';
import SQLite from 'react-native-sqlite-storage';
import SQLiteStorage from 'redux-persist-sqlite-storage';
const storeEngine = SQLiteStorage(SQLite);
// import logger from 'redux-logger';
const logger = createLogger({
collapsed: true,
duration: true,
logErrors: true
});
SQLite.DEBUG(true);
SQLite.enablePromise(true);
const persistConfig = {
storage: storeEngine,
debug: true
};
// const persistedReducer = persistReducer(persistConfig, todoReducer);
// let store = createStore(persistedReducer, {}, applyMiddleware([thunk, logger]));
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import rootReducer from '../reducers/root_reducer';
const middlewares = [thunk];
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
if (process.env.NODE_ENV !== 'production') {
// must use 'require' (import only allowed at top of file)
const { createLogger } = require('redux-logger');
middlewares.push(createLogger());
}
const configureStore = (preloadedState = {}) => {
return (
createStore(
rootReducer,
preloadedState,
composeEnhancers(
applyMiddleware(...middlewares)
))
)
};
export default configureStore;
stateTransformer: (state) => state,
actionTransformer: (action) => action,
errorTransformer: (error) => error,
diff: true,
diffPredicate: (getState, action) => true,
});
let loggerCollapsedBool = createLogger({
collapsed: true
});
let loggerCollapsedPredicate = createLogger({
collapsed: (getAction, action) => true
});
let loggerColorsBoolean = createLogger({
colors: {
title: false,
prevState: false,
action: false,
nextState: false,
error: false
}
});
let loggerColorsFunction = createLogger({
colors: {
title: (action) => '#000',
prevState: (state) => '#000',
action: (action) => '#000',
nextState: (state) => '#000',
error: (error, prevState) => '#000'
export default function initializeStore(): Store {
const middlewares = [thunk];
if (process.env.NODE_ENV === 'development') {
middlewares.push(
createLogger({
collapsed: true,
titleFormatter: (action, time, duration) =>
`[action] ${action.type} (in ${duration.toFixed(2)} ms)`,
logErrors: false,
duration: true,
})
);
}
const store = createStore(reducers, applyMiddleware(...middlewares));
return store;
}
import { createStore, applyMiddleware, compose } from 'redux'
import thunk from 'redux-thunk'
import { createLogger } from 'redux-logger'
import rootReducer from '../reducers'
const logger = createLogger({
collapsed: true,
duration: true,
})
const configureStore = initialState => {
const hasWindow = typeof window !== 'undefined'
const store = createStore(
rootReducer,
initialState,
compose(
applyMiddleware(thunk, logger),
hasWindow && window.devToolsExtension ? window.devToolsExtension() : f => f
)
)
import { createStore, applyMiddleware, combineReducers, compose } from 'redux'
import thunk from 'redux-thunk'
import { hashHistory } from 'react-router'
import { routerMiddleware, routerReducer } from 'react-router-redux'
import { persistState } from 'redux-devtools'
import { createLogger } from 'redux-logger'
import reducers from '../reducers'
import DevTools from '../DevTools'
const logger = createLogger({
level: 'info',
collapsed: true
})
const router = routerMiddleware(hashHistory)
const rootReducer = combineReducers({
...reducers,
routing: routerReducer
})
const enhancer = compose(
applyMiddleware(thunk, router, logger),
DevTools.instrument(),
persistState(window.location.href.match(/[?&]_k=([^&]+)\b/))
)