reactotron-redux
Version:
A Reactotron plugin for Redux.
21 lines (20 loc) • 803 B
JavaScript
;
import reactotronReducer from "./reducer.js";
import createCustomDispatch from "./customDispatch.js";
export default function createEnhancer(reactotron, pluginConfig, handleStoreCreation) {
return (skipSettingStore = false) => createStore => (reducer, ...args) => {
const originalStore = createStore(reactotronReducer(reducer, pluginConfig.restoreActionType), ...args);
const store = {
...originalStore,
dispatch: createCustomDispatch(reactotron, originalStore, pluginConfig)
};
if (!skipSettingStore) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore shhhhhh -- this is a private API
reactotron.reduxStore = store;
handleStoreCreation();
}
return store;
};
}
//# sourceMappingURL=enhancer.js.map