WebStudio/src/store.ts
Marks Polakovs 5ece897b2e Refactor MixerState (#94)
* Refactor MixerState

This extracts the actual audio handling out from MixerState into a separate module with two classes, Player and AudioEngine, because separation of concerns good and 1,000 line file bad.

* Remove unnecessary module

* Fix mic calibration

* rename engine to audioEngine

* Fix a butchered merge

* remove a bunch of unused imports
2020-04-24 11:00:24 +02:00

30 lines
896 B
TypeScript

import rootReducer, { RootState } from "./rootReducer";
import { configureStore, Action, getDefaultMiddleware } from "@reduxjs/toolkit";
import { ThunkAction } from "redux-thunk";
import {
mixerMiddleware,
mixerKeyboardShortcutsMiddleware,
} from "./mixer/state";
import { persistStore } from "redux-persist";
const store = configureStore({
reducer: rootReducer,
middleware: [
mixerMiddleware,
mixerKeyboardShortcutsMiddleware,
...getDefaultMiddleware(),
],
});
if (process.env.NODE_ENV === "development" && module.hot) {
module.hot.accept("./rootReducer", () => {
const newRootReducer = require("./rootReducer").default;
store.replaceReducer(newRootReducer);
});
}
export const persistor = persistStore(store);
export type AppDispatch = typeof store.dispatch;
export type AppThunk = ThunkAction<void, RootState, null, Action<string>>;
export default store;