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


TypeScript compose.compose函數代碼示例

本文整理匯總了TypeScript中@ngrx/core/compose.compose函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript compose函數的具體用法?TypeScript compose怎麽用?TypeScript compose使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了compose函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: rootReducer

export function rootReducer (state: AppBackgroundState, action: Action) {
  if (action.type === 'SET_NEW_STATE') {
      state = Object.assign({}, state, action.payload);
  }
  if (!environment.production) {
    return compose(storeLogger(), combineReducers)(appBackgroundState)(state, action);
  } else {
    return compose(combineReducers)(appBackgroundState)(state, action);
  }
}
開發者ID:Le0Michine,項目名稱:Messanger,代碼行數:10,代碼來源:app-background.store.ts

示例2: compose

import { storeLogger } from 'ngrx-store-logger';
import { localStorageSync } from 'ngrx-store-localstorage';

import { IState as ICounterState, reducer as counterReducer } from './counter';
import { IState as IUserState, reducer as userReducer } from './user';
import { IState as IConfigState, reducer as configReducer } from './config';

// application state interface
export interface IState {
  router: RouterState;
  config: IConfigState;
  counter: ICounterState;
  user: IUserState;
}

// app level reducers
export const reducers = {
  router: routerReducer,
  config: configReducer,
  counter: counterReducer,
  user: userReducer
};

// root reducer
export const reducer: ActionReducer<IState> = compose(
  storeLogger(),
  storeFreeze,
  localStorageSync(keys(reducers), true),
  combineReducers
)(reducers);
開發者ID:lunches-platform,項目名稱:fe,代碼行數:30,代碼來源:app.reducer.ts

示例3: isLoading

 public static isLoading(): (selector: Observable<AppState>) => Observable<boolean> {
   return compose(this._isLoading(), this.getAuthState());
 }
開發者ID:ddellamico,項目名稱:ionic-conference-app,代碼行數:3,代碼來源:auth.selector.ts

示例4: getErrorMessage

 /**
  * Every reducer module exports selector functions, however child reducers
  * have no knowledge of the overall state tree. To make them useable, we
  * need to make new selectors that wrap them.
  *
  * Once again our compose function comes in handy. From right to left, we
  * first select the auths state then we pass the state to the auth
  * reducer's _getAuthItems selector, finally returning an observable
  * of search results.
  */
 public static getErrorMessage(): (selector: Observable<AppState>) => Observable<string> {
   return compose(this._getErrorMessage(), this.getAuthState());
 }
開發者ID:ddellamico,項目名稱:ionic-conference-app,代碼行數:13,代碼來源:auth.selector.ts

示例5: isCubeInCollection

export function isCubeInCollection(id: string) {
  return compose(fromCubesCollection.isCubeInCollection(id), getCubesCollectionState());
}
開發者ID:mlukasch,項目名稱:indigo,代碼行數:3,代碼來源:index.ts

示例6: getCollectionCubeIds

export function getCollectionCubeIds() {
  return compose(fromCubesCollection.getCubeIds(), getCollectionState());
}
開發者ID:mlukasch,項目名稱:indigo,代碼行數:3,代碼來源:index.ts

示例7: getCubesCollectionLoading

export function getCubesCollectionLoading() {
  return compose(fromCubesCollection.getLoading(), getCubesCollectionState());
}
開發者ID:mlukasch,項目名稱:indigo,代碼行數:3,代碼來源:index.ts

示例8: getCubesSearchQuery

export function getCubesSearchQuery() {
  return compose(fromCubesSearch.getQuery(), getCubesSearchState());
}
開發者ID:mlukasch,項目名稱:indigo,代碼行數:3,代碼來源:index.ts

示例9: compose

import { compose } from '@ngrx/core/compose';

import * as fromMissingWord from './missing-word-exercise/missing-word-exercise.reducer';
import { getSelectedExerciseState } from './exercises.reducer';

export { ExercisesRoutes } from './exercises.routes';
export { ExercisesComponent } from './exercises.component';
export { exercisesReducer } from './exercises.reducer';

export const getSelectedExerciseSentences = compose(fromMissingWord.getMissingWordsSentences, getSelectedExerciseState);
export const getSelectedExerciseMissingWordsAnswers = compose(fromMissingWord.getMissingWordsAnswers, getSelectedExerciseState);
export const getSelectedExerciseSentencesNums = compose(fromMissingWord.getMissingWordsNums, getSelectedExerciseState);
export const getSelectedExerciseMissingWords = compose(fromMissingWord.getMissingWords, getSelectedExerciseState);
export const isSelectedExerciseValidated = compose(fromMissingWord.isValidated, getSelectedExerciseState);
開發者ID:pocmanu,項目名稱:angular2-seed-advanced,代碼行數:14,代碼來源:index.ts

示例10: compose

import { compose } from "@ngrx/core/compose";
// reducers
import { videos, EchoesVideos } from './youtube-videos';
import { player, YoutubePlayerState, PlayerActions} from './youtube-player';
import { nowPlaylist, YoutubeMediaPlaylist, NowPlaylistActions} from './now-playlist';
import { user, UserProfile } from './user-manager';
import { search, PlayerSearch} from './player-search';
import { localStorageSync } from './ngrx-store-localstorage';

/**
 * As mentioned, we treat each reducer like a table in a database. This means
 * our top level state interface is just a map of keys to inner state types.
 */
export interface EchoesState {
  videos: EchoesVideos;
  player: YoutubePlayerState;
  nowPlaylist: YoutubeMediaPlaylist;
  user: UserProfile;
  search: PlayerSearch;
}

export const actions = [
  NowPlaylistActions,
  PlayerActions
];

export default compose(
  localStorageSync(['videos', 'player', 'nowPlaylist', 'search'], true),
  combineReducers
)({ videos, player, nowPlaylist, user, search });
開發者ID:DavyDuDu,項目名稱:echoes-ng2,代碼行數:30,代碼來源:index.ts


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