本文整理汇总了TypeScript中@ngrx/core.compose函数的典型用法代码示例。如果您正苦于以下问题:TypeScript compose函数的具体用法?TypeScript compose怎么用?TypeScript compose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compose函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: compose
import {appDb} from "../store/reducers/appdb.reducer";
import {msDatabase} from "../store/reducers/msdb.reducer";
import {storeFreeze} from "ngrx-store-freeze";
import {ActionReducer, combineReducers} from "@ngrx/store";
import {ApplicationState} from "./application.state";
import {compose} from "@ngrx/core";
import {MainAppShowStateEnum} from "../app/app-component";
import {LocationMarkModel} from "../models/LocationMarkModel";
import {StationModel} from "../models/StationModel";
import {FasterqLineModel} from "../models/fasterq-line-model";
import {FasterqQueueModel} from "../models/fasterq-queue-model";
import {FasterqAnalyticsModel} from "../models/fasterq-analytics";
import {LiveLogModel} from "../models/live-log-model";
const reducers = {msDatabase, appDb};
export const developmentReducer: ActionReducer<ApplicationState> = compose(storeFreeze, combineReducers)(reducers);
export const productionReducer: ActionReducer<ApplicationState> = combineReducers(reducers);
export enum StoryBoardListViewModeEnum {
ListMode,
StoryMode
}
export interface IMsDatabase {
thread: { [key: number]: any };
sdk: ISDK;
}
export interface IStation {
id: number;
localAddress: any;
示例2: combineReducers
*/
const reducers = {
operations: fromOperations.reducer,
currencies: fromCurrencies.reducer
}
/**
* Using combineReducers to create the Meta Reducer and export it from the module.
* The exported Meta Reducer will be used as an argument
* in provideStore() in the application's root module.
*/
const combinedReducer: ActionReducer<State> = combineReducers(reducers);
export function reducer(state: any, action: any) {
return combinedReducer(state, action);
}
export function getOperations(state$: Observable<State>) {
return state$.select(state => state.operations);
}
export function getCurrencies(state$: Observable<State>) {
return state$.select(state => state.currencies);
}
export const getEntities = compose(fromOperations.getEntities, getOperations);
export const getCurrencyEntities = compose(fromCurrencies.getCurrenciesEntities , getCurrencies);
export const getSelectedCurrency = compose(fromCurrencies.getSelectedCurrency , getCurrencies);
export const getCurrencyRates = compose(fromCurrencies.getRates , getCurrencies);
示例3: compose
import { combineReducers } from '@ngrx/store';
import { compose } from '@ngrx/core';
import { emailStepReducer } from 'app/store/reducers/email-step.reducer';
import { professionalStepReducer } from 'app/store/reducers/professional-step.reducer';
export default compose(combineReducers)({
emailStep: emailStepReducer,
professionalStep: professionalStepReducer
});
示例4: compose
apiResponse: fromApiResponse.reducer,
apiTrendsResponse: fromApiTrendsResponse.reducer,
pagination: fromPagination.reducer,
apiUserResponse: fromApiUserResponse.reducer,
suggestService: fromSuggest.reducer,
suggestResponse: fromSuggestResponse.reducer,
mediaWallQuery: fromMediaWallQuery.reducer,
mediaWallResponse: fromMediaWallResponse.reducer,
mediaWallSearch: fromMediaWallSearch.reducer,
mediaWallCustom: fromMediaWallCustom.reducer,
mediaWallPagination: fromMediaWallPagination.reducer,
mediaWallDesign: fromMediaWallDesign.reducer,
mediaWallDirectUrl: fromMediaWallDirectUrl.reducer
};
const developmentReducer: ActionReducer<State> = compose(storeFreeze, combineReducers)(reducers);
const productionReducer: ActionReducer<State> = combineReducers(reducers);
export function reducer(state: any, action: any) {
if (environment.production) {
return productionReducer(state, action);
}
else {
return developmentReducer(state, action);
}
}
/**
* A selector function is a map function factory. We pass it parameters and it
* returns a function that maps from the larger state tree into a smaller
* piece of state. This selector simply selects the `repository` state.
示例5: compose
// Re export symbol for commodity
export { Store, Action, State } from '@ngrx/store';
import { REDUCERS as PROJECTS_REDUCER } from './projects.reducer';
var REDUCERS = Object.assign({}, PROJECTS_REDUCER);
export var PROVIDERS: Array<any> = [];
const initialState = {
}
import { StoreModule, combineReducers } from '@ngrx/store';
import { compose } from '@ngrx/core';
import { storeLogger } from 'ngrx-store-logger';
export const MODULE =
StoreModule.provideStore(
compose(
storeLogger({ collapsed: true }),
combineReducers
)(REDUCERS),
initialState);