Skip to main contentredux-mvc

Bridge Middleware

addBridge

Adds the trackGlobalNamespaces array and the dispatchToGlobal filter function, that will later be used by the bridgeMiddleware.

Usage

  • Should be executed after any merge decorator if you want to override the default trackGlobalNamespaces and dispatchToGlobal.

    const newModule = R.compose(
    addBridge({ trackGlobalNamespaces, dispatchToGlobal })
    ...
    merge(searchBar),
    )(module)

Parameters

  1. trackGlobalNamespaces?: Array<String>

    The array of namespace dependencies from the global context.

    If trackGlobalNamespaces is not passed, then addBridge will merge the trackGlobalNamespaces from all the module dependencies.

  2. dispatchToGlobal?: (action: ActionPayload) -> Boolean

    This predicate function will be used by the bridgeMiddleware to forward actions to the global context.

    If dispatchToGlobal is not passed, then addBridge will dispatch to the global context any action that is not in any namespace of the module dependencies.

Return value

  • newModule

    newModule = {
    ...module,
    trackGlobalNamespaces,
    dispatchToGlobal,
    }