@laserware/redial
    Preparing search index...

    Function createRedialMainMiddleware

    • Creates middleware that forwards dispatched actions to the renderer process to ensure global state is in sync. The optional hooks argument allows you to make changes to the action prior to forwarding and after forwarding before passing the action to the next middlewares.

      Parameters

      Returns RedialMainMiddleware

      Middleware with a dispose method for cleaning up any IPC event listeners.

      import { createRedialMainMiddleware } from "@laserware/redial/main";
      import { configureStore, type Store } from "@reduxjs/toolkit";
      import { app } from "electron";

      import { rootReducer } from "../common/rootReducer";

      export function createStore(): Store {
      const redialMiddleware = createRedialMainMiddleware();

      const store = configureStore({
      reducer: rootReducer,
      middleware: (getDefaultMiddleware) =>
      getDefaultMiddleware().concat(redialMiddleware),
      });

      app.on("before-quit", () => {
      // Perform cleanup:
      redialMiddleware.dispose();
      });
      }