export function promiseMiddleware()

in src/legacy/promise/promiseMiddleware.ts [14:39]


export function promiseMiddleware(
    next: LegacyDispatchFunction,
    action: ActionFunction,
    actionType: string,
    args: IArguments,
    actionContext: ActionContext
) {
    // If we're not already installed, install now
    if (!isInstalled) {
        uninstall = install();
        isInstalled = true;
    }

    try {
        actionStack.push(actionType);
        return next(action, actionType, args, actionContext);
    } finally {
        actionStack.pop();

        // If we're no longer in an action, uninstall
        if (!actionStack.length) {
            uninstall();
            isInstalled = false;
        }
    }
}