How to use the redux-dynamic-modules.getRefCountedManager function in redux-dynamic-modules

To help you get started, we’ve selected a few redux-dynamic-modules examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / redux-dynamic-modules / packages / redux-dynamic-modules-saga / src / SagaExtension.ts View on Github external
//@ts-ignore
    if (process.env.NODE_ENV === "development" && typeof window !== "undefined") {
        sagaMonitor = window["__SAGA_MONITOR_EXTENSION__"] || undefined;
    }

    // Setup the saga middleware
    let sagaMiddleware: SagaMiddleware = createSagaMiddleware({
        context: sagaContext,
        sagaMonitor,
        onError,
    });

    let _sagaManager: IItemManager<
        ISagaRegistration
    > = getRefCountedManager(getSagaManager(sagaMiddleware), sagaEquals);

    return {
        middleware: [sagaMiddleware],

        onModuleManagerCreated: (moduleManager: IModuleManager) => {
            if (sagaContext) {
                sagaContext["moduleManager"] = moduleManager;
            }
        },

        onModuleAdded: (module: ISagaModule): void => {
            if (module.sagas) {
                _sagaManager.add(module.sagas);
            }
        },

redux-dynamic-modules

Modularize the redux app by dynamically loading reducers, state and sagas

MIT
Latest version published 4 years ago

Package Health Score

59 / 100
Full package analysis