本文整理汇总了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);
}
}
示例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);
示例3: isLoading
public static isLoading(): (selector: Observable<AppState>) => Observable<boolean> {
return compose(this._isLoading(), this.getAuthState());
}
示例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());
}
示例5: isCubeInCollection
export function isCubeInCollection(id: string) {
return compose(fromCubesCollection.isCubeInCollection(id), getCubesCollectionState());
}
示例6: getCollectionCubeIds
export function getCollectionCubeIds() {
return compose(fromCubesCollection.getCubeIds(), getCollectionState());
}
示例7: getCubesCollectionLoading
export function getCubesCollectionLoading() {
return compose(fromCubesCollection.getLoading(), getCubesCollectionState());
}
示例8: getCubesSearchQuery
export function getCubesSearchQuery() {
return compose(fromCubesSearch.getQuery(), getCubesSearchState());
}
示例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);
示例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 });