Interface RedialRendererMiddleware

Redial middleware in the renderer process. Provides a dispose method to clean up resources as well as methods to get the state from the main process asynchronously or synchronously.

interface RedialRendererMiddleware {
    dispose(): void;
    getMainState<S extends AnyState = AnyState>(): Promise<S>;
    getMainStateSync<S extends AnyState = AnyState>(): S;
    (
        api: MiddlewareAPI<Dispatch<UnknownAction>, any>,
    ): (next: (action: unknown) => unknown) => (action: unknown) => unknown;
}

Hierarchy (View Summary)

Methods

  • Returns the current state from the main process asynchronously. This is useful for syncing the state with the renderer in development mode (i.e. persisting state after refreshing the page). Use this if you don't want to block the main thread while requesting state.

    Type Parameters

    Returns Promise<S>

    Promise that resolves with the current state from the main process.

  • Returns the current state from the main process synchronously. This is useful for syncing the state with the renderer in development mode (i.e. persisting state after refreshing the page).

    Caution

    This will block the main thread until the state is returned from the main process. You should only use this in development to keep state synchronized between reloads of the renderer process.

    If you want to get the state without blocking the main thread, you can use the getMainState method.

    Type Parameters

    Returns S

    Current state from the main process.