Options
All
  • Public
  • Public/Protected
  • All
Menu

This interface represents the glue that connects the subscription-oriented Redux Store with the RXJS Observable-oriented Angular component world.

Augments the basic Redux store interface with methods to enable selection and fractalization.

Type parameters

  • StateType

  • A: Action

Hierarchy

  • Store<StateType>
    • ObservableStore

Implemented by

Index

Properties

configureSubStore

configureSubStore: function

Carves off a 'subStore' or 'fractal' store from this one.

The returned object is itself an observable store, however any selections, dispatches, or invocations of localReducer will be specific to that substore and will not know about the parent ObservableStore from which it was created.

This is handy for encapsulating component or module state while still benefiting from time-travel, etc.

Type declaration

dispatch

dispatch: Dispatch<A>

Dispatches an action. It is the only way to trigger a state change.

The reducer function, used to create the store, will be called with the current state tree and the given action. Its return value will be considered the next state of the tree, and the change listeners will be notified.

The base implementation only supports plain object actions. If you want to dispatch a Promise, an Observable, a thunk, or something else, you need to wrap your store creating function into the corresponding middleware. For example, see the documentation for the redux-thunk package. Even the middleware will eventually dispatch plain object actions using this method.

param

A plain object representing “what changed”. It is a good idea to keep actions serializable so you can record and replay user sessions, or use the time travelling redux-devtools. An action must have a type property which may not be undefined. It is a good idea to use string constants for action types.

returns

For convenience, the same action object you dispatched.

Note that, if you use a custom middleware, it may wrap dispatch() to return something else (for example, a Promise you can await).

select

select: function

Select a slice of state to expose as an observable.

typeparam
param

key or function to select a part of the state

param

comparison function called to test if an item is distinct from the previous item in the source.

returns

An Observable that emits items from the source Observable with distinct values.

Type declaration

    • <SelectedType>(selector: Selector<StateType, SelectedType>, comparator?: Comparator): Observable<SelectedType>
    • Type parameters

      • SelectedType

      Parameters

      Returns Observable<SelectedType>

Methods

getState

  • getState(): StateType

replaceReducer

  • replaceReducer(nextReducer: Reducer<StateType, A>): void
  • Replaces the reducer currently used by the store to calculate the state.

    You might need this if your app implements code splitting and you want to load some of the reducers dynamically. You might also need this if you implement a hot reloading mechanism for Redux.

    Parameters

    • nextReducer: Reducer<StateType, A>

      The reducer for the store to use instead.

    Returns void

subscribe

  • subscribe(listener: function): Unsubscribe
  • 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 call getState() to read the current state tree inside the callback.

    You may call dispatch() from a change listener, with the following caveats:

    1. The subscriptions are snapshotted just before every dispatch() call. If you subscribe or unsubscribe while the listeners are being invoked, this will not have any effect on the dispatch() that is currently in progress. However, the next dispatch() call, whether nested or not, will use a more recent snapshot of the subscription list.

    2. The listener should not expect to see all states changes, as the state might have been updated multiple times during a nested dispatch() before the listener is called. It is, however, guaranteed that all subscribers registered before the dispatch() started will be called with the latest state by the time it exits.

    Parameters

    • listener: function

      A callback to be invoked on every dispatch.

        • (): void
        • Returns void

    Returns Unsubscribe

    A function to remove this change listener.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc