當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript core.compose函數代碼示例

本文整理匯總了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;
開發者ID:born2net,項目名稱:signagestudio_web-lite,代碼行數:31,代碼來源:store.data.ts

示例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);


開發者ID:mtranggit,項目名稱:ng-redux-fin-app,代碼行數:28,代碼來源:index.ts

示例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
});
開發者ID:hugoparis19,項目名稱:funnel,代碼行數:9,代碼來源:tunnel.state.ts

示例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.
開發者ID:eddygta17,項目名稱:loklak_search,代碼行數:31,代碼來源:index.ts

示例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);
開發者ID:ClementVidal,項目名稱:infra.starter.themba,代碼行數:25,代碼來源:index.ts


注:本文中的@ngrx/core.compose函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。