import * as Redux from 'redux'; import { Store } from 'redux'; import { NgZone } from '@angular/core'; import { Observable } from 'rxjs/Observable'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/filter'; import 'rxjs/add/observable/from'; import 'rxjs/add/operator/distinctUntilChanged'; import 'rxjs/add/operator/switchMap'; import 'rxjs/add/operator/skipWhile'; export declare type PropertySelector = string | number | symbol; export declare type PathSelector = (string | number)[]; export declare type FunctionSelector = ((s: RootState) => S); export declare type Comparator = (x: any, y: any) => boolean; export interface ISuspendableState { $suspended: boolean; } export declare class NgRedux { private ngZone; private _store; private _store$; private _defaultMapStateToTarget; private _defaultMapDispatchToTarget; static instance: any; /** * Creates an instance of NgRedux. */ constructor(ngZone: NgZone); /** * configures a Redux store and allows NgRedux to observe and dispatch * to it. * * This should only be called once for the lifetime of your app, for * example in the constructor of your root component. * * @param {Redux.Reducer} reducer Your app's root reducer * @param {RootState} initState Your app's initial state * @param {Redux.Middleware[]} middleware Optional Redux middlewares * @param {Redux.StoreEnhancer[]} Optional Redux store enhancers */ configureStore(reducer: Redux.Reducer, initState: RootState, middleware?: Redux.Middleware[], enhancers?: Redux.StoreEnhancer[]): void; /** * Accepts a Redux store, then sets it in NgRedux and * allows NgRedux to observe and dispatch to it. * * This should only be called once for the lifetime of your app, for * example in the constructor of your root component. If configureStore * has been used this cannot be used. * * @param {Redux.Store} store Your app's store */ provideStore(store: Store): void; /** * Select a slice of state to expose as an observable. * * @template S * @param { PropertySelector | * PathSelector | * FunctionSelector} * selector key or function to select a part of the state * @param { Comparator } [comparer] Optional * comparison function called to test if an item is distinct * from the previous item in the source. * * @returns {Observable} an Observable that emits items from the * source Observable with distinct values. */ select(selector?: PropertySelector | PathSelector | FunctionSelector, comparator?: Comparator): Observable; /** * Get the current state of the application * @returns {RootState} the application state */ getState: () => RootState; /** * Subscribe to the Redux store changes * * @param {() => void} listener callback to invoke when the state is updated * @returns a function to unsubscribe */ subscribe: (listener: () => void) => Redux.Unsubscribe; /** * 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. * * @param nextReducer The reducer for the store to use instead. */ replaceReducer: (nextReducer: Redux.Reducer) => void; /** * Dispatch an action to Redux */ dispatch: (action: A) => any; private getStateSlice(state, mapStateToScope); private setStore(store); }