Interface CoreEngine<State, ExtraArguments, Configuration>

interface CoreEngine<
    State extends object = {},
    ExtraArguments extends ThunkExtraArguments = ThunkExtraArguments,
    Configuration extends CoreConfigurationState = CoreConfigurationState,
> {
    dispatch: EngineDispatch<
        State & { configuration: Configuration; version: string } & Partial<
            SearchParametersState,
        >,
        ExtraArguments,
    >;
    logger: Logger;
    navigatorContext: NavigatorContext;
    relay: Relay;
    state: State & { configuration: Configuration; version: string } & Partial<
        SearchParametersState,
    >;
    store: EnhancedStore<
        any,
        UnknownAction,
        Tuple<[StoreEnhancer<{ dispatch: {} }, {}>, StoreEnhancer<{}, {}>]>,
    >;
    addReducers(
        reducers: { [key: string]: Reducer<any, UnknownAction, any> },
    ): void;
    disableAnalytics(): void;
    enableAnalytics(): void;
    subscribe(listener: () => void): Unsubscribe;
}

Type Parameters

  • State extends object = {}
  • ExtraArguments extends ThunkExtraArguments = ThunkExtraArguments
  • Configuration extends CoreConfigurationState = CoreConfigurationState

Methods

  • Adds the specified reducers to the store.

    Parameters

    • reducers: { [key: string]: Reducer<any, UnknownAction, any> }

      An object containing the reducers to attach to the engine.

    Returns void

  • Disable analytics tracking

    Returns void

  • Enable analytics tracking

    Returns void

  • Adds a change listener. It will be called any time an action is dispatched, and some part of the state tree may potentially have changed. You may then access the new state.

    Parameters

    • listener: () => void

      A callback to be invoked on every dispatch.

    Returns Unsubscribe

    A function to remove this change listener.

Properties

dispatch: EngineDispatch<
    State & { configuration: Configuration; version: string } & Partial<
        SearchParametersState,
    >,
    ExtraArguments,
>

Dispatches an action directly. This is the only way to trigger a state change. Each headless controller dispatches its own actions.

An action supported by the headless engine.

For convenience, the action object that was just dispatched.

logger: Logger

The logger instance used by headless.

navigatorContext: NavigatorContext

The navigator context (referer, location, UserAgent)

relay: Relay

The Relay instance used by Headless.

state: State & { configuration: Configuration; version: string } & Partial<
    SearchParametersState,
>

The complete headless state tree.

store: EnhancedStore<
    any,
    UnknownAction,
    Tuple<[StoreEnhancer<{ dispatch: {} }, {}>, StoreEnhancer<{}, {}>]>,
>

The redux store.