Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getEpicManager(
epicMiddleware: EpicMiddleware
): IEpicManager {
let runningEpics: { [epicKey: string]: IEpicWrapper } = {};
// @ts-ignore
let epicRefCounter = getObjectRefCounter();
return {
/**
* Dynamically add epics.
*
* We should consider these potential problem:
* * Epic could add repeatedly
* * Epic could as a dependency of two or more modules
* * Module hot load. React-hot-loader will rerender your react root
* component which means it will invoke all of your logic again. So this is
* minor worry.
*/
add(epics: Epic[] = []) {
epics.forEach(epic => {
const epicKey = epic.toString();
// Check if epic already exists