Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var port, tabId
// Setup port for communication with the background script
if (chrome) {
try {
tabId = chrome.devtools.inspectedWindow.tabId;
port = chrome.runtime.connect(null, { name: "panel" });
port.postMessage({ tabId, action: "init" });
port.onMessage.addListener(_onMessageRecived);
chrome.tabs.onUpdated.addListener(_onTabUpdated);
} catch (error) {
console.warn("not running app in chrome extension panel")
}
}
const store = configureStore({
reducer: {
network: networkReducer,
toolbar: toolbarReducer,
clipboard: clipboardReducer,
}
});
function _onMessageRecived({ action, data }) {
if (action === "gRPCNetworkCall") {
store.dispatch(networkLog(data));
}
}
function _onTabUpdated(tId, { status }) {
if (tId === tabId && status === "loading") {
store.dispatch(clearLog());
import { configureStore } from "redux-starter-kit";
// import devToolsEnhancer from "remote-redux-devtools";
import rootReducer from "./reducers";
const store = configureStore({
reducer: rootReducer,
devTools: false
});
export default store;
addTodo(state, action) {
// You can "mutate" the state in a reducer, thanks to Immer
state.push(action.payload)
},
toggleTodo(state, action) {
const todo = state.find(todo => todo.id === action.payload);
todo.complete = !todo.complete;
},
deleteTodo(state, action) {
return state.filter((todo) => todo.id !== action.payload)
}
}
})
// configureStore automatically adds the Redux DevTools and combines reducers
export const store = configureStore({
reducer : {
todos : todosReducer
}
});
export const {addTodo, toggleTodo, deleteTodo} = actions;
export default (history, initialState) => {
const sagaMiddleware = createSagaMiddleware();
const store = configureStore({
middleware: [
...getDefaultMiddleware(),
routerMiddleware(history),
sagaMiddleware,
],
reducer: createRootReducer(history),
preloadedState: initialState,
});
store.runSaga = sagaMiddleware.run;
store.close = () => store.dispatch(END);
return store;
};
export default function configureAppStore() {
const store = configureStore({
reducer: rootReducer
//middleware: [thunk],
//devTools: process.env.NODE_ENV !== "production"
});
return store;
}
createStore() {
logger.info('Creating redux store');
this.store = configureStore({
middleware: [
...getDefaultMiddleware(),
reduxLogger
],
reducer
});
logger.info('Created store', this.store);
},
import { configureStore } from "redux-starter-kit";
import repoDetailsReducer from "./features/RepoSearch/repoDetails";
import issuesDisplayReducer from "./features/IssuesDisplay/issuesDisplay";
import issuesReducer from "./features/IssuesList/issues";
import commentsReducer from "./features/IssueDetails/comments";
export const store = configureStore({
reducer: {
repoDetails: repoDetailsReducer,
issuesDisplay: issuesDisplayReducer,
issues: issuesReducer,
comments: commentsReducer,
},
});
export type RootState = ReturnType;
const persistedReducers = persistReducer(persistConfig, rootReducers);
const defaultMiddlewareConfig = {
serializableCheck: {
ignoredActions: ['persist/PERSIST'],
},
};
const middleware = [
sagaMiddleware,
...getDefaultMiddleware(defaultMiddlewareConfig),
logger,
];
const store = configureStore({
reducer: persistedReducers,
middleware,
devTools: process.env.NODE_ENV !== 'production',
});
sagaMiddleware.run(rootSaga);
const persistor = persistStore(store);
export {store, persistor};
export function createStore(initialState = {}): Store {
return configureStore({
reducer: rootReducer,
preloadedState: initialState
});
}
export default function configureAppStore() {
const store = configureStore({
reducer: {
counters: countersReducer,
strings: stringsReducer
}
});
return store;
}